leto.net
Google
 
blog
code
freebsd
gitweb
math
pics
travel
writing

del.icio.us
Digg!
share

FreeBSD 6.2 on IBM/Lenovo ThinkPad T42 Laptop

Getting Sound to Work

Problem: I try to play music/CD/mp3's with xmms/mpg123/x11amp and I get some error message about the sound device not being configured.

Solution You probably have not loaded the FreeBSD kernel module that talks to /dev/pcm0, which is what the kernel calls your soundcard. These modules ( files ending in .ko ) implement device-specific stuff, so it makes sense to only load the ones that you actually have. Try the command

# kldload snd_ich You should see lines something like these in your /var/log/messages : Jun 14 12:26:42 polyglot kernel: pcm0: <Intel ICH4 (82801DB)> port 0x1c00-0x1cff,0x18c0-0x18ff mem 0xc0000c00-0xc0000dff,0xc0000800-0xc00008ff irq 11 at device 31.5 on pci0 Jun 14 12:26:43 polyglot kernel: pcm0: <Analog Devices AD1981B AC97 Codec> You can look at the list of currently loaded kernel modules with the kldstat command, which should have output something like this: Id Refs Address Size Name 1 11 0xc0400000 617fd4 kernel 2 1 0xc0a1a000 59d60 acpi.ko 3 1 0xc44f0000 a000 ntfs.ko 4 1 0xc4776000 16000 linux.ko 5 1 0xc47da000 d000 msdosfs.ko 32 1 0xc469c000 5000 snd_ich.ko 33 1 0xc4bfc000 1c000 sound.ko Now if you put the following line in your /boot/loader.conf file, this will happen automatically at boot snd_ich_load="YES" If this does not work, than all is not lost. There is an all-in-one sound module called snd_driver. If you run the command # kldload snd_driver as root and then look at kldstat, you should see about twenty different sound modules loaded. Then look in /var/log/messages for stuff referring to /dev/pcm*. This can be accomplished with tail -n 100 /var/log/messages | grep pcm Good luck!

Putting Laptop into sleep mode

Problem: You want to put the the laptop to sleep on command.

Solution There are fancy settings to get the laptop to sleep when the lid is closed, but I do not like those "features." I define a simple bash alias

alias gotosleep="killall -9 xmms;acpiconf -s S3" If you put this into your .bashrc in your home directory, then run source .bashrc to read in the new alias. Now you can run the command gotosleep as root to put the laptop to sleep. Since I always have a root shell open, this is not a problem for me, but you could set this up as a SETUID root program so that it can be run as a normal user, but SETUID root programs have cooties.

PS: The kill command for xmms was needed because I noticed that acpiconf would hang if xmms was running and then the laptop had to be manually rebooted. YMMV.


Jonathan Leto - jonathan at leto dot net

Generated Monday 06th of October 2008 07:32:18 AM
Clicky Web Analytics

Clicky