Anyone have an idea as to how to automatically detect the USB number and create a sym link in the dosdevices directory. The problem is that I have several USB devices not used at the same time, and when the USB to serial adapter is connected, a /dev/ttyUSB? is assigned. To use this assignment under WINE, I need to automatically detect /dev/ttyUSB? and then create a sym link in ~/.wine/dosdevices for the Windows program to use it. Of course, when the cable is disconnected, the symlink must also be removed. An alternate way is to reserve the serial port to one device (/dev/ttyUSB0 for example) and then create a permanent symlink in the dosdevices directory. This means that other devices must not use this reservation. Any ideas are appreciated. Charlie Morrison
Charles Morrison wrote:> Anyone have an idea as to how to automatically detect the USB number and > create a sym link in the dosdevices directory. > > The problem is that I have several USB devices not used at the same > time, and when the USB to serial adapter is connected, a /dev/ttyUSB? is > assigned. To use this assignment under WINE, I need to automatically > detect /dev/ttyUSB? and then create a sym link in ~/.wine/dosdevices for > the Windows program to use it. Of course, when the cable is > disconnected, the symlink must also be removed. > > An alternate way is to reserve the serial port to one device > (/dev/ttyUSB0 for example) and then create a permanent symlink in the > dosdevices directory. This means that other devices must not use this > reservation. > > Any ideas are appreciated.You can write a rule for udev to always create the same named device and then create your symlink. You can get started by reading this HOWTO <http://reactivated.net/writing_udev_rules.html> Also search on Google using "write udev rules" Gus
>>>>> "Charles" == Charles Morrison <eplurib at earthlink.net> writes:Charles> Anyone have an idea as to how to automatically detect the USB Charles> number and create a sym link in the dosdevices directory. Charles> The problem is that I have several USB devices not used at the Charles> same time, and when the USB to serial adapter is connected, a Charles> /dev/ttyUSB? is assigned. To use this assignment under WINE, I Charles> need to automatically detect /dev/ttyUSB? and then create a sym Charles> link in ~/.wine/dosdevices for the Windows program to use Charles> it. Of course, when the cable is disconnected, the symlink must Charles> also be removed. Perhaps you can coerce udev to create the link. Charles> An alternate way is to reserve the serial port to one device Charles> (/dev/ttyUSB0 for example) and then create a permanent symlink Charles> in the dosdevices directory. This means that other devices must Charles> not use this reservation. Again udev comes into play. Try with "lsusb -v" to find something like a serial number that makes the device unique. No use udev to create a unique devicefile if that unique device is plugged in. -- Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt --------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------