Sunday, September 04, 2011

Wifi, webcam and sound in FreeBSD 8.2 0n Netbook

In my last post on this topic I revealed that FreeBSD 8.2 had been installed and was working well on my Asus EeePC 901 netbook.
Now, I've cleaned things up a lot and the OS is looking very good now that I've got sound, wifi and the webcam working.
Incidentally, with all that I have installed, the /usr slice which is 8.9 GB in size still has 2.1 GB available.

Wifi

This machine has a Ralink2860 wireless card and the driver is not available in the FreeBSD kernel or from ports.
However, a "homemade" driver for FreeBSD 8 is available from here. To ue this, unzip it and then cd to the newly made folder and "make" to compile the driver module called rt2860.ko.
Now, as root,

cp rt2860.ko /boot/modules/
chmod 555 /boot/modules/rt2860.ko

At this point, it's very worthwhile to read the Wireless section in the Handbook.
Then add this line to /boot/loader.conf
rt2860.ko_load="YES"

and these lines to /etc/rc.conf
wlans_rt28600="wlan0"
ifconfig_wlan0="WPA DHCP"

As I'm using WPA-PSK security in my router, I had to create a /etc/wpa_supplicant.conf file with the following content:
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=wheel

network={
ssid="mynetworkname"
key_mgmt=WPA-PSK
psk="mynetworkpassword"
}

Before rebooting, you must set up the wlan0 interface with these commands (as root):
kldload rt2860.ko
ifconfig wlan0 create wlandev rt28600

Now, according to the Handbook and several other references that I read, a wifi connection should be available on boot. But for me, even though dmesg said that wlan0 was "up" and the Network Connection applet in the Gnome Panel showed no errors, when I tried to ping I got a "no route to host" error.
To overcome this,I had to create a script file as follows
#! /bin/sh
sleep 10
/etc/rc.d/netif stop
sleep 20
ifconfig wlan0 create wlandev rt28600

which is used to stop the wlan0 interface and re-create it from rt28600.
I added an executable version of this script to startup applications and this worked fine. Wifi is available just shortly after the Desktop opens and works perfectly.
I admit that I don't fully understand why the script is necessary and I'll probably post to the FreeBSD forums to get some elucidation.
The strange thing is that the output from "ifconfig wlan0" is exactly the same before and after I run the above script. So, the wlan0 does exist and is shown as associated in both cases. Yet, one works and the other does not.
It'll be interesting to see what insights I learn from the forum.

Sound

This netbook has an Intel N10/ICH 7 HDA controller for which there is no specific driver. However, the default sound driver, loaded by
# kldload snd_driver

works fine.
To get it to load automatically on boot,just add this line to /boot/loader.conf:
snd_driver_load="YES"

I should mention that I had to select a different sound input device in the sound applet in the gnome panel before sound worked properly.
As always, the Handbook has extensive explanations of most of what you need to know in the area of sound.

Webcam

To get the webcam working on my EeePC 901 netbook was also very easy.
Most of what you need is explained here.
However, with FreeBSD 8.2 that I am using, all of the required apps are already installed (v4l_compat, libv4l, pwcview, webcamd, cuse4bsd).
All I had to do was to add this line to /etc/rc.conf
webcamd_enable="YES"

and this to /boot/loader.conf
cuse4bsd_load="YES"

Then, after a reboot,just run pwcview from a terminal as root path is /usr/local/bin/pwcview).
However, haven't yet figured out what I can do with the webcam other than admire the live video of myself. But here's a list of apps that all work with webcamd although I'm not sure how available any of the patched sources are.
In particular, it seems Skype can't yet be run in FreeBSD with video (although it can be used without).




1 comment:

  1. You can try GotoCamera compatible wireless IP cameras. All that one needs to do, is set-up an account on GotoCamera and hook up a camera to monitor their home, office or business. For more details on how to set-up an account go to http://www.gotocamera.com . Once the account is set-up, you can access your cameras (snapshots and videos), view and manage your camera footage stored on the GotoCamera servers, and change your motion detection settings. The only time you would need a computer is during set-up, after which you can monitor your home, office, business or loved ones without the need of a computer and from anywhere in the world. GotoCamera is giving you peace of mind for a song!

    ReplyDelete