Ljocha and NetBSD

Hotswapping floppy/CD-ROM of Dell Latitude C600 in NetBSD

The hardware of the Dell Latitude C600 laptop allows changing battery, CD-ROM and floppy in the module bay while the machine is on.

I made it work in NetBSD, developed in 1.5.3, it works now in 1.6 as well. Follow the steps bellow to try it:

  1. Download hotswap.tar.gz and unpack it.

  2. Apply pciide.patch on dev/pci/pciide.c in you kernel source tree, add something like

    options HOTSWAP_ATAPI_CHAN="\"pciide0:1\"" 
    
    to your kernel configuration and rebuild the kernel.

    The patch makes the boot-up scan of IDE devices not to disable the channel given by HOTSWAP_ATAPI_CHAN even if there are no devices attached.

    Unfortunately, this is rather ugly as it's inside the Intel PIIX specific code (though porting it to other chipsets should be quite straigthforward). I didn't find a better way to make the kernel revive the secondary IDE in other way later. Tell me if you know, please.

    If you don't want to hack your kernel just don't do this. Everything works without the patch as long as you boot up with the CD-ROM in the module bay.

  3. Edit the Makefile to substitute correct paths to the kernel source and compile directories and "make all" to build both the kernel module and the control program.

  4. Load the module hotswap_mod.o (e.g. with "make load"). It provides a syscall to trigger changes in the kernel device configuration.

  5. The new syscall is called by the hotswap control program. Its usage is

    hotswap [-u] -s syscall { fd[<ctrl>:<drive>] | ide[<ctrl>:<channel>] }
    

I run the stuff on my laptop for some time and it seems be quite stable (unlike the Linux hotswap I got from somewhere some time ago).

The Dell BIOS is aware of the device which is loaded. I suspect there is some interface so that it would not be necessary to trigger the changes manually but I didn't find any details anywhere.

In general, I don't feel to be an expert in kernel programming, so that it's quite likely various things can be done better. Any improvements are welcome.

News

May 27, 2003 I realized the tarball was made using the old version causing kernel page faults in 1.6. Fixed.

May 19, 2004 The stuff does not work for 2.0. I'm working on it.

Synaptics touchpad absolute mode driver

July 1, 2004

My original motivation

As my laptop gets older, it tends to move mouse cursor spontaneously, especially when not laid on a table. Rather annoying -- it is difficult to use external mouse e.g. on plane. Through Windows I've found out that the spontaneous movement comes from the stickpointer, not the touchpad (which I prefer to use). So I looked for disabling the stickpointer originally.

Synaptics touchpad

Virtually all the info can be really found on www.synaptics.com, Google helped otherwise.

In a nutshell, the touchpad either emulates mouse (relative mode) or sends more or less raw information on the finger contact (absolute mode). The stickpointer is attached to a passthrough port of the touchpad. The ps/2 aux port receives packets from both the touchpad and the passthrough port. In absolute mode it is possible to distinguish between packets coming from touchpad and the passthrough port (maybe it's also possible in the relative mode but I don't know how).

This patch (on NetBSD 2.0 dev/pckbport/pms.c) detects Synaptics touchpad, switches it into absolute mode, and translates its packets into wsmouse events.

The interrupt handler (pmsinput() replacement) justs gathers 6-byte absolute mode packets. Due to the "tap" and "tap-and-drag" gesture recognition (mapped into appropriate button events) a dedicated kernel thread is spawned to actually process the packets. Also APM suspend/resume needs special treatment -- experimentally I've found out that the only safe way is PMS_RESET after APM resume.

TODOs

News

January 2005: The stuff was merged into NetBSD-current. I'm probably not going to support it anymore.

OpenSC & OpenCT for NetBSD

SmartCard library and applications with support for PKCS #15 compatible cards.

Home site of the project is www.opensc.org.

You can download my NetBSD pkgsrc port of these packages here. Untar them in /usr/pkgsrc/security.


Ales Krenek ljocha@ics.muni.cz