LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   Force a USB device to use a specific /dev/ttyUSBX (http://www.linuxquestions.org/questions/linux-software-2/force-a-usb-device-to-use-a-specific-dev-ttyusbx-413348/)

garnser 02-09-2006 03:22 AM

Force a USB device to use a specific /dev/ttyUSBX
 
Hi, I'm putting up this system to control my switches, I'm using a USB2Serial converter that I can get the id from in /proc/bus/usb/devices, there's a problem though, since it's USB it change tty device if I reboot the server that's controlling the switches and so on so I wonder if there's any way to force a specific Serialnumber from /proc/bus/usb/devices to be a specific /dev/ttyUSBX.

I'm using Fedora Core 4

acid_kewpie 02-09-2006 03:38 AM

this would presumably be irrelevant to the usb side of the device, instead you would assign this, in fc4 at least, via the udev framework defined in /etc/udev/ to use a certain device on recognising a certain attribute of the device

garnser 02-09-2006 04:44 AM

I've succeded to map a specific usbdevice to a /dev/device but don't get how to map the device so i can use it as an tty, how do i do this?

this is the rule for the device
BUS="usb", SYSFS{serial}="FTCD6IQC", NAME="USBconverterHP2626b", SYMLINK="usbconverters/USBHP2626b"

JZL240I-U 02-09-2006 04:47 AM

I think it's in the file /etc/udev/udev.d/static_devices.txt

Have a look at

http://www.reactivated.net/writing_udev_rules.html
http://ftp.kernel.org/pub/linux/util...tplug/udev-FAQ

garnser 02-10-2006 07:28 AM

well I came a bit but i solved it with a perlscript instead:

opendir(DIR, '/sys/class/tty/');
@files = grep { /ttyUSB/ } readdir(DIR);
closedir(DIR);

foreach (@files) {
$tmp = readpipe('udevinfo -a -p /sys/class/tty/'.$_.' | grep SYSFS{serial}==\"F');
@tmp2 = split('"', $tmp);
system('ln -s /dev/'.$_.' /dev/ttyUSB'.$tmp2[1]);
}


All times are GMT -5. The time now is 05:37 PM.