[ltp] apm sound script
Bibek Sahu
linux-thinkpad@www.bm-soft.com
Sun, 4 Feb 2001 02:47:31 -0600 (CST)
This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
Send mail to mime@docserver.cac.washington.edu for more info.
---1463811286-6840093-981275548=:1616
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
Content-ID: <Pine.LNX.4.21.0102040238471.1616@shadow.dodds.net>
Howdy all,
I have a thinkpad A21p (which has a cs461x sound chip) running Linux
2.4.0 and ALSA 0.5.10a. I also have the kernel's cs46xx driver built, but
it doesn't handle suspends worth crap, so I stick to ALSA (which at least
allows the soundcard to be used after an apm resume).
However, the system won't go to sleep if the sound device is open (I
presume this is related to not putting the PCI bus to sleep, but I don't
know). The attached script takes care of this problem and mixer settings.
In my setup (Debian unstable), this goes into /etc/apm/event.d; I
presume it's similar on RedHat and other such distributions. Basically, if
you have esdctl installed (which presumably means you're running esd), it
uses that to suspend esound (which causes it to release the sound device)
before an apm suspend event and resume it after an apm resume event. Also,
if you have alsactl installed (which presumably means you're using alsa), it
uses that to store your mixer settings before a suspend event and restore
your mixer settings after a resume event. The former (esdctl stuff) is
necessary because the system won't go to sleep while the sound device is
open; the latter (alsactl stuff) is necessary because the mixer settings are
all garbled after a resume event. I imagine it'd be very easy to add
support for aRts (the kde sound daemon), but since I don't know much about
it I can't say for sure.
Note: you may have to edit the paths to the programs to match your
system. It just adds a couple of directories to the search path and lets
the system find the program, so chances are you won't have to touch it...
but just be aware of it. The setting is at the top of the script.
If you're using esd and alsa on a debian unstable system, you need
the 'esound-clients' and 'alsa-utils' packages.
And at 649 bytes, the script is significantly shorter than this
message. ;-)
Enjoy.
- Bibek
---1463811286-6840093-981275548=:1616
Content-Type: TEXT/PLAIN; charset=US-ASCII; name=sound
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.LNX.4.21.0102040247310.1616@shadow.dodds.net>
Content-Description:
Content-Disposition: attachment; filename=sound
IyEvYmluL3NoDQojIChyZSlzdG9yZSB0aGUgc291bmQgcGFyYW1ldGVycw0K
DQojIEFkZCBwYXRocyBhcyBuZWNlc3NhcnkgdG8gZmluZCB0aGUgZXNkY3Rs
IGFuZCBhbHNhY3RsIHByb2dyYW1zDQpQQVRIPS91c3Ivc2JpbjovdXNyL2xv
Y2FsL3NiaW46JFBBVEgNCg0KIyBFc291bmQgY29udHJvbCBwcm9ncmFtDQpF
U0RDVEw9ZXNkY3RsDQoNCiMgQUxTQSBjb250cm9sIHByb2dyYW0NCkFMU0FD
VEw9YWxzYWN0bA0KDQppZiBbICIkMSIgPSBzdXNwZW5kIF07IHRoZW4NCgkj
IFByZXBhcmUgZm9yIHN1c3BlbmQNCgkNCgkjIFB1dCBlc2QgaW4gc3RhbmRi
eSAoaS5lLiwgbWFrZSBpdCByZWxlYXNlIHRoZSBkZXZpY2UpDQoJIiRFU0RD
VEwiIG9mZiAyPi9kZXYvbnVsbA0KCQ0KCSMgU3RvcmUgdGhlIGN1cnJlbnQg
bWl4ZXIgY29uZmlndXJhdGlvbiBpbiAvZXRjL2Fzb3VuZC5jb25mDQoJIiRB
TFNBQ1RMIiBzdG9yZSAyPi9kZXYvbnVsbA0KDQplbGlmIFsgIiQxIiA9IHJl
c3VtZSBdOyB0aGVuDQoJIyBSZXN1bWluZyBhZnRlciBzdXNwZW5kDQoJDQoJ
IyBSZXN1bWUgZXNkDQoJIiRFU0RDVEwiIG9uIDI+L2Rldi9udWxsDQoJDQoJ
IyBSZXN0b3JlIHRoZSBtaXhlciBjb25maWd1cmF0aW9uIGZyb20gL2V0Yy9h
c291bmQuY29uZg0KCSIkQUxTQUNUTCIgcmVzdG9yZSAyPi9kZXYvbnVsbA0K
ZmkNCg==
---1463811286-6840093-981275548=:1616--
----- The Linux ThinkPad mailing list -----
The linux-thinkpad mailing list home page is at:
http://www.bm-soft.com/~bm/tp_mailing.html