Hardware installation under GNU/Linux

IBM T41p · Kensington remote controller · ML-1710 · Bluetooth · IXUS-v2 · WPA · Toucam 2

Each time I need to configure a new device under GNU/Linux, I crawl the web to find HOWTOs and FAQs and various personal experiences with the same hardware. Since the latter are usually the most useful because they are very practical, here are my own experiences.

Most of the information provided here is outdated. Recent Linux distributions install without major glitch and hardware tends to get obsolete faster than I update my web page.

Thinkpad T41p

I am the happy owner of an IBM Thinkpad T41p (2373GEG). This is a light real sized laptop (2.2Kg) with an excellent screen (14.1'' TFT 1400x1050), a correct CPU (Pentium-M 1.7Ghz), a correct hard disk (60Gb 7200rpm), all the modern wireless stuff (bluetooth and 802.11a,b,g) and the wonderful Thinkpad keyboard.

It seems that certain version of the T41p have display troubles with the configuration I give below. Mine is a T41p 2373GEG, BIOS v2.14 (1RET87WW) 26/01/2004. My X server is XFree86 Version 4.3.0.1 (Debian package xfree86-common 4.3.0.dfsg.1-6)

Linux Kernel and xorg

I am using the vanilla 2.6.12 Linux Kernel with this .config. With that version of the kernel, the ACPI S3 suspend mode works perfectly, even if you suspend while having heavy network trafic and mp3 playing in progress. You can also download a working xorg.conf for a dual-head with a 1280×1024 external display. Since dual-head is not compatible with DRI, I guess there is a slight hit in performances compared to single display with DRI.

Hack to suspend by closing the lid

Here is a simple hack to make the computer go into sleep mode when the screen is closed. You have to compile the kernel with ACPI, install acpid and put the following in /etc/acpi/events/lidbutton

# /etc/acpi/events/lidbutton
# This is called when the user closes the screen

event=button/lid
action=/etc/acpi/lidbtn.sh

and for kernel up to 2.6.12 put in /etc/acpi/lidbtn.sh

#!/bin/sh
# /etc/acpi/lidbtn.sh
# Go into sleep mode when the screen is closed

echo 3 > /proc/acpi/sleep

for kernel 2.6.13 (and more recent, I guess) use

#!/bin/sh
# /etc/acpi/lidbtn.sh
# Go into sleep mode when the screen is closed

echo mem > /sys/power/state

Set this file executable and restart acpid. There is no need for other change, acpid will scan /etc/acpi/events and take into account all event handlers found there.

Samsung ML-1710

This procedure is totally useless when using a recent version of CUPS. With it, you just need to get the adequate ppd file (which is present in the Debian package foomatic-filters-ppds) and everything runs flawlessly.

The ML-1710 is a small laser printer from Samsung. I bought it for 200€, it is fast (18 pages / min), small, has a very high text quality (but pretty bad picture rendering) and the toner costs something like 0.025€ per page. This printer is advertised as Linux compliant and sold with a GNU/Linux driver CD. Still, it is standard enough to be perfectly used with usual GNU/Linux tools. Here is my installation procedure to avoid to use the drivers provided by the manufacturer.

  1. Activate the USB in the kernel. Here are all my kernel option related to USB with the 2.6.13 kernel

    CONFIG_BT_HCIUSB=y
    CONFIG_BT_HCIUSB_SCO=y
    CONFIG_USB_ARCH_HAS_HCD=y
    CONFIG_USB_ARCH_HAS_OHCI=y
    CONFIG_USB=y
    CONFIG_USB_DEBUG=y
    CONFIG_USB_DEVICEFS=y
    CONFIG_USB_SUSPEND=y
    CONFIG_USB_EHCI_HCD=y
    CONFIG_USB_UHCI_HCD=y
    CONFIG_USB_PRINTER=y
    CONFIG_USB_STORAGE=y
    CONFIG_USB_STORAGE_DEBUG=y
    CONFIG_USB_HID=y
    CONFIG_USB_HIDINPUT=y

  2. You can use /dev/usb/lp0, or if required, create a device with

    mknod /dev/usblp c 180 0

    check that you see 180 0 when doing ls -l on the device.
  3. Install lpd and lpr (they are in the same package on Debian, and should be installed by default in any decent distribution).
  4. Install gs (8.01-5) and magicfilter (1.2-58)
  5. Run magicfilterconfig with gdi as input filter
  6. Copy into /etc the file /var/tmp/printcap which has just been created. Mine has the following content

    lp|ml1710|Samsung ML-1710:\
            :lp=/dev/usblp:sd=/var/spool/lpd/ml1710:\
            :sh:pw#80:pl#72:px#1440:mx#0:\
            :if=/etc/magicfilter/gdi-filter:\
            :af=/var/log/lp-acct:lf=/var/log/lp-errs:

  7. Edit by hand (this is a configuration file, do not feel guilty to change it) the filter /etc/magicfilter/gdi-filter to replace the -r300 by -r600 and the -D 300 by -D 600 so that the resolution will be 600dpi and not 300dpi. Without that hack the printer gives poor results.

When this is done and lpd restarted, you should be able to print postscript things with lpr. Note that the default printer is lp.

To print from a remote machine, first add the hostname of the remote machine in the /etc/hosts.lpd of the computer on which the printer is hooked, and use the following /etc/printcap on the machine you want to print from (here fw is the hostname of the machine with the printer.)

lp|ml1710|Samsung ML-1710:\
        :lp=:rp=lp:rm=fw:sd=/var/spool/lpd/ml1710:

Bluetooth

I tried this with a USB dongle MSI/6968 and a kernel 2.4.24, and also with a Thinkpad T41p with integrated bluetooth and a kernel 2.6.9. My OS is a GNU/Linux Debian and my phone is a Sony-Ericsson T630. For bluetooth, I have in my .config for the kernel

CONFIG_BLUEZ=y
CONFIG_BLUEZ_L2CAP=y
CONFIG_BLUEZ_RFCOMM=y
CONFIG_BLUEZ_RFCOMM_TTY=y
CONFIG_BLUEZ_HCIUSB=y

I also have the USB settings given above for the ML-1710, and I used the standard installation with apt-get for the packages

When this is done, run hcid and spd. On the T41p, you need to activate the USB by pressing Fn-F5 (the bluetooth led should switch on). The typical session to check that you can see your phone (the xx:xx:xx:xx:xx:xx has to be replaced by the proper identifier)

# To set the bluetooth interface up
hciconfig hci0 up
# To see the available bluetooth devices around
hcitool scan
# To get the private name of the phone
hcitool name xx:xx:xx:xx:xx:xx
# To see the available services on that phone
sdptool browse xx:xx:xx:xx:xx:xx

Typical session to upload things from the phone to the computer

# To add the "push" service on your computer (this one is to allow
# people to upload things)
sdptool add --channel=10 OPUSH
# To listen for a file (it will be saved in /tmp)
obexserver
# Then you can "push" from your phone to the computer

Typical session to upload things to the phone (you need to peer the phone with the computer. The computer PIN code is in my case indicated in /etc/bluetooth/pin.)

# To list a directory on the phone
obexftp -b xx:xx:xx:xx:xx:xx -B 15 -l /
# To upload a file from the computer to the phone
obexftp -b xx:xx:xx:xx:xx:xx -B 15 -p Zen.thm

Canon Ixus V2

This trick is not required anymore with Debian, since the gphoto2 package now puts some scripts so that the device belongs to the camera group. Thus, you just need to be in that group to access the camera with no pain.

This camera is supported by the standard gphoto tools. The only hack I had to make was to automatically set the group of the USB device as adm so that users of that group could access the camera (i.e. one can download his pictures without being root).

To do that, you first need to have the hotplug package installed under Debian. Then, just add in /etc/hotplug/usb/ixusv2.usermap the following

devforadm.sh 0x0003 0x04a9 0x3065 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000

and in /etc/hotplug/usb/devforadm.sh the following script

#!/bin/sh
# Arguments :
# -----------
# ACTION=[add|remove]
# DEVICE=/proc/bus/usb/BBB/DDD
# TYPE=usb

case ${ACTION} in
    add)
        if [[ ! -f ${DEVICE} ]]; then
            sleep 1
        fi
        chgrp adm ${DEVICE}
        chmod 664 ${DEVICE}
        ;;
    *)
        ;;
esac

This script is automagically invoked when the camera is plugged-in, and the device can then be accessed by all users belonging to the adm group. You can use my getpics.sh script to download your pictures easily

WPA encryption

I am the happy owner of a Linksys WRT54G. This is a little router with 802.11b/g wireless capabilities and five ethernet ports. I use it at home with WPA encryption for the wireless part. Under GNU/Linux, the WPA encryption is done by the mean of a small daemon called wpa_supplicant.

My computer has an integrated Atheros wireless chipset, and I use a Debian Sarge GNU/Linux distribution with a kernel 2.6.9. The Madwifi driver is the only one available for the Atheros card, and it is only partially open-source. See the note at the end of that section for solving troubles with the new generation version of madwifi.

By the way, if someone can tell me why the HAL (Hardware Access Layer, an API to access the card) being binary-only makes the whole stuff more legal, please mail me. I'd be curious to read that.

Configuration of the WRT54G

You have to chose a name for your network, set the encryption scheme, and specify the pre-shared key (an arbitrary passphrase). Connect to the router with the WWW interface and

  1. Go to Wireless / Basic Wireless Settings and set your SSID (the name of your wireless network)
  2. Go to Wireless / Wireless Security and set:

Configuration of GNU/Linux

  1. Install wpa_supplicant (v0.3.2). Under Debian it is in the wpasupplicant package.
  2. Edit /etc/wpa_supplicant.conf. Mine contains (with the pre-shared key in clear text, as in the WRT54G)

    ctrl_interface=/var/run/wpa_supplicant

    network={
            ssid="your SSID"
            scan_ssid=1
            psk="your pre-shared key"
            key_mgmt=WPA-PSK
            proto=WPA
    }

  3. Load the Madwifi modules (either with insmod, or by putting the list of modules in /etc/modules so that they are loaded automatically at boot). Typing lsmod tells me

    Module                  Size  Used by
    wlan_wep                5760  0
    wlan_tkip              10752  2
    wlan_ccmp               6144  0
    wlan_acl                3968  0
    wlan_xauth              1280  0
    ath_pci                52640  0
    ath_rate_onoe           7048  1 ath_pci
    wlan                  107356  8 wlan_wep,wlan_tkip,wlan_ccmp,wlan_acl,wlan_xauth,ath_pci,ath_rate_onoe
    ath_hal               131536  2 ath_pci

  4. Set the wireless interface up (note that it also adds a basic routing table). You may use 0.0.0.0 for IP if you want to use DHCP.

    ifconfig ath0 up 192.168.1.5

  5. Run wpa_supplicant. The -B option puts wpa_supplicant into background and you can add -dd to get heavy debug information.

    wpa_supplicant -Dmadwifi -iath0 -c/etc/wpa_supplicant.conf -B

    Note that in practice I have several wpa_supplicant.conf in my user account, related to the several locations where I use the Wifi connection (home, work, etc.)
  6. If you want to use DHCP

    dhcpcd ath0

    The dhcpcd packaged in Debian is very prudent and does not setup automatically the /etc/resolv.conf. Check the man page, or use dhcpcd-bin if you want a more standard behavior.

After a few seconds, you should be able to ping hosts on your LAN.

I add troubles with the new madwifi (ng series) and wpa_supplicant. The connection was up for a few seconds, then down, up again, etc. cycling every 10 seconds or so. The solution was to remove all non-necessary modules, in particular wlan_xauth. As far as I understand, the functionality of that module is already provided by either the madwifi driver or wpa_supplicant and having the module loaded just confuses things. Finally the modules I load are ath_hal, ath_pci, ath_rate_sample, wlan_scan_sta, wlan_scan_ap, wlan_tkip and wlan.

Philips toucam pro II

The Philips Toucam Pro 2 is a nice high-quality USB webcam. It works seamlessly with recent kernels and the adequate driver. Unfortunately, the driver included in the kernel tree (up to 2.6.13 at least) does not work in my case and I had to download a more recent version from the developper's site. My camera is recognized as the following by the kernel

usb 3-2: SerialNumber: 01690000A5000000
pwc Philips PCVC740K (ToUCam Pro)/PCVC840 (ToUCam II) USB webcam detected.

To install it, first download the archive of the driver pwc-10.0.7a.tgz. Unarchive it, run make ; make install. This requires the kernel source and as far as I understand you must have compiled the kernel once. Now you should have a new kernel module

/lib/modules/2.6.13/kernel/drivers/usb/media/pwc.ko

As root, you can try to load it with modprobe pwc. The camera's red led should switch on. You can try the camera with applications such as gnomemeeting or more simply camstream.

You can chose the image size and the frame-rate by providing parameters to the module. For instance modprobe pwc fps=30,size=sip or modprobe pwc fps=15,size=vga. Note that, as far as I know, the open-source driver does not include some decompression scheme that allow to exploit the camera at full frame-rate and high resolution (one more case of a manufacturer who believes keeping stupid secrets is more important than allowing customers to use hardware they own the way they want). Thus, the driver refuses a frame-rate higher than 30fps for 320x240 (sif) and higher than 15fps for 640x480 (vga).

Finally you can load automatically the driver at boot time by adding something like

pwc fps=30 size=sif

in /etc/modules.