[FreeNX-kNX] usb pen devices.
Dimitar Paskov
pascoff at nola7.com
Mon Feb 18 11:04:14 UTC 2008
> Hi Dimitar and all,
>
> Some time ago you mentioned you had resolved usb local devices on nx
> clients using LTSP technology.
>
>> Devices like floppy, cd/dvdrom and usb sticks are working very well with thin clients due to the good work of the people at the LTSP project.
>
> I was wondering how you did that. With ltspfs?
>
> I'm really thinking about usb pen devices.
> What's the best way to mount these devices that are plugged in by the user?
>
> Thanks.
> Chris.
Hi
(for short version go to the end)
Yes, you are right, I have local devices working in thin client
environment. I use ltspfs with the help of udev and some shell
scripting. I have made this under Ubuntu 6.06 with some additional
scripts from LTSP distribution. The main programs are:
- ltspfsd - this is the daemon which is running on the thin client and
is "watching" for local device status (there is a deb package for it)
- lbuscd - a perl daemon which communicates with the server on which is
the running nx session (this is from the LTSP distro)
- some udev scripts
--------------
- lbussd - a perl daemon which runs on the server and communicates with
lbuscd on the thin client (this is from the LTSP distro)
- lbus_event_handler.sh - a script that gets executed on the server upon
event (like usb pen device insert/remove on the thin client) (this is
from the LTSP distro)
- ltspfs - fuse based remote filesystem for ltsp thin cients (also has
deb package)
How all this work. When there is an event (like adding a usb device) the
udev daemon (with the help of the kernel) executes a script like this:
################
# USB Pens
KERNEL=="sd[a-z][1-4]",
RUN+="/etc/udev/scripts/ltsp-device.sh ${DEVNAME} ${ACTION}
#############
DEVNAME may be /dev/sda1 for example, ACTION is "add" or "remove"
This script sends information about the device to lbuscd daemon which
forwards it to lbussd daemon running on the server. Then lbussd executes
lbus_event_handler.sh which mounts the device with ltspfs command which
communicates with ltspfsd daemon on the thin client.
lbus_event_handler.sh also does some neat stuff like placing an icon on
the users desktop pointing to the directory the device is mounted in.
After the user has removed the device, this script removes the icon from
his desktop and unmounts the device. (actually it is unmounted before
that by the ltspfsd daemon). The best thing about ltspfs is that it
unmounts devices automatically after short timeout and you can mount
with sync option and be sure that all information will be copied before
the device is unmounted. No more locked cdroms and broken usb
filesystems. Floppies are mounted all the time (for obvious reasons),
cd/dvds are mounted only when there is a medium in the device and usb
stuff only when inserted. Note that there are 2 mounts that are
happening. The fake one with ltspfs (based on fuse filesystem) that
"mounts" the thin client from the server and the real mount of the
device that happens on the thin client through ltspfsd. All this acts
like the old supermount fs (in kernel 2.6.9 - 2.6.13) - the device gets
mounted only when it is accessed.
May be I wrote too much :) anyway in short:
install ltspfsd on the thin client and copy lbuscd + udev scripts
(/etc/udev/rules.d/15-ltsp-block.rules;
/etc/udev/scripts/ltsp-device.sh) from the LTSP site. Install ltspfs on
the server and copy lbussd and lbus_event_handler.sh from the LTSP site.
Follow the scripts to see if all works like it should. Ask if you have
any questions. Hope this helps :)
More information about the FreeNX-kNX
mailing list