RonBaughman
From K12LTSP Wiki
HOTPLUGING K12TSP
I've been using the K12LTSP both at home and at work and have marveled over its' capabilities. One of the things that interests me is what is possible to get running on a diskless workstation in terms of business use. Such items would include a PDA, scanner, printer, etc. with USB interfaces as these are items commonly used in my workplace.
Getting the USB setup in the workstation environment is not difficult, but modifying each workstation for the required modules to be loaded depending on what peripherals were connected seemed to be a lot of work especially with the number of configurations one could end up with. A generic solution would be to hotplug the workstation and let it do the job of loading the drivers. This was accomplished with a bit of copying and pasting and some simple scripts.
I am currently running K12LTSP 3.1.0 but have managed to get this same technique to work for the earlier versions as well. My original goal was to interface my Sharp Zaurus SL5000D to the workstation and use the Qtopia Desktop as a local app. The desktop app hasn't quite worked out yet but hope springs eternal. At any rate the hotpluging works well and should take some of the driver loading tedium away.
Step 1: Copying files
The followin files/folders need to be copied:
- copy /sbin/hotplug to /opt/ltsp/i386/sbin/ --- This is the hotplug helper script the kernel calls
- copy /bin/awk to /opt/ltsp/i386/bin/ --- Note: This is a link to gawk
- copy /bin/gawk to /opt/ltsp/i386/bin/ --- Satisfies the above link
- copy /sbin/lsusb to /opt/ltsp/i386/sbin/ --- Needed for Hotplug
- copy /sbin/usbmodules to /opt/ltsp/i386/sbin/ --- Needed for Hotplug
- copy the entire /etc/hotplug folder to opt/ltsp/i386/etc/
_Step 2: Starting the USB system
Starting the USB system requires a startup script in the /opt/ltsp/i386/etc/rc.d folder as follows: <verbatim>
- ====/bin/sh ====
modprobe usbcore mount -t usbfs none /proc/bus/usb modprobe usb-ohci modprobe usb-uhci </verbatim>
I named mine usbstart and placed it in the /opt/ltsp/i386/etc directory/rc.d/.
_Step 3: Modify the lts.conf file
Depending on your needs, you can run the script globaly or on a per workstation basis. I noticed a global section containing the line RCFILE02 usb and replace it with the RCFILE02 usbstart. ( I don't use a USB Mouse or Keyboard but if you do, you may have tweak the usb file to add the usbstart sequence).
_Step 4: Testing
Set a terminal with USB capability to boot at runlevel 3. As the workstation starts, you should see the USB system startup. At the command prompt plug in one of your devices. Ignore the no active driver found comment. In a few seconds you should get several lines indicating the device plugged in and some information about the device and it's driver.
_Next: Automating other tasks
One of the nice things about hotplug is it's capability to run other needed tasks after the device is registered. For example with my Zaurus, I needed to set up some networking parameters after the driver was loaded. This can be accomplished by placing a script file named the same as the driver being loaded in the /opt/ltsp/i386/etc/hotplug/usb folder. For example, the driver for the Zaurus is usbdnet.o, so I created a file called usbdnet in the above mentioned folder and added the networking info to configure my driver thus
<verbatim>
- ====/bin/sh ====
ifconfig usb0 192.168.129.200 netmask 255.255.255.0 up </verbatim>
For other devices, make sure the file name matches the driver being loaded without th .o extension.
_Finally
Devices I've tried with this setup include a Sandisk flash card interface, my Zaurus, and Intel Play digital microscope. In each case the proper driver loaded when plugged in. Hope you have the same fortune and good luck.
Comments? Criticism? Slander? Libel? Contact me at rbaughman@fuse.net <verbatim> Ron Baughman Systems Analyst Shriners Hospitals Cincinnati </verbatim>
