/dev/ttyUSB0,1,2 force a device

Forum regarding Linux Software and Home Automation Domotica.
Post Reply
Kroonen
Member
Member
Posts: 302
Joined: Mon Oct 01, 2007 6:38 pm
Location: Netherlands

/dev/ttyUSB0,1,2 force a device

Post by Kroonen »

I have some trouble with the ttyUSB ports. If I do a reboot or sometimes I poweroff, the ttyUSB ports are different, the ttyusb for rfxcom, heyu, and 1-wire are than different. Can you force it like for example in a modprobe.conf???
User avatar
Snelvuur
Forum Moderator
Forum Moderator
Posts: 3156
Joined: Fri Apr 06, 2007 11:01 pm
Location: Netherlands
Contact:

/dev/ttyUSB0,1,2 force a device

Post by Snelvuur »

Good question, although i never had this issue. Do you have an usb in between? or just all on a different port?

// Erik (binkey.nl)
Kroonen
Member
Member
Posts: 302
Joined: Mon Oct 01, 2007 6:38 pm
Location: Netherlands

/dev/ttyUSB0,1,2 force a device

Post by Kroonen »

Have three use on lapotp, 2 on docking and one not. But als busy with more ports, so with usbhub, and that#347; also terribl, so it should be nice to define them so it works always ok.
User avatar
Snelvuur
Forum Moderator
Forum Moderator
Posts: 3156
Joined: Fri Apr 06, 2007 11:01 pm
Location: Netherlands
Contact:

/dev/ttyUSB0,1,2 force a device

Post by Snelvuur »

Did you take a look at "hotplug" ? Also, i know you can for instance for a usb device to come up always the same if its storage like:

UUID=ca982c63-6358-4a57-a6ae-2686768997f1 / ext3 defaults,errors=

So there is bound a way to do it, but dont know how to search it on google.. "usb/reboot/device" etc gives too much hits hehe.



// Erik (binkey.nl)
Kroonen
Member
Member
Posts: 302
Joined: Mon Oct 01, 2007 6:38 pm
Location: Netherlands

/dev/ttyUSB0,1,2 force a device

Post by Kroonen »

it should be done with udev, in /etc/udev dir. it is not easy, but i searching for it
beanz
Starting Member
Starting Member
Posts: 20
Joined: Wed Jun 13, 2007 11:22 am
Location: United Kingdom
Contact:

/dev/ttyUSB0,1,2 force a device

Post by beanz »

I created a file /etc/udev/rules.d/50-ttyUSB.rules which contains lines like these two:

BUS=="usb",SYSFS{idProduct}=="6001",SYSFS{idVendor}=="0403",SYSFS{serial}=="A4001XXX",SYMLINK="rfxcom-rx"
BUS=="usb",SYSFS{idProduct}=="6001",SYSFS{idVendor}=="0403",SYSFS{serial}=="A5001YYY",SYMLINK="rfxcom-tx"

where the SYSFS{*} values are taken from the output of commands like:

udevinfo -a -p `udevinfo -q path -n /dev/ttyUSB0`

This causes udev to create symlinks in /dev for rfxcom-rx and rfxcom-tx pointing to the dynamically assigned devices.
User avatar
vossie
Starting Member
Starting Member
Posts: 20
Joined: Tue Jan 13, 2009 12:25 pm
Location: Netherlands
Contact:

Re: /dev/ttyUSB0,1,2 force a device

Post by vossie »

A little bit late but maybe helpfull for somone else.
here is my /etc/udev/rules.d/62-usbserial.rules (i am using fedora 16)

Code: Select all

SUBSYSTEM=="tty" ATTRS{idVendor}=="0403" ATTRS{idProduct}=="c850" ATTRS{serial}=="DEORA98A" OWNER="nico" GROUP="users" SYMLINK+="dmxcontr" MODE="0777"
SUBSYSTEM=="tty" ATTRS{idVendor}=="0403" ATTRS{idProduct}=="6001" ATTRS{serial}=="A4004nGU" OWNER="nico" GROUP="users" SYMLINK+="rfxcom"
SUBSYSTEM=="tty" ATTRS{idVendor}=="0403" ATTRS{idProduct}=="6001" ATTRS{serial}=="A2003F6l" OWNER="nico" GROUP="users" SYMLINK+="plugwise"
SUBSYSTEM=="tty" ATTRS{idVendor}=="0403" ATTRS{idProduct}=="6001" ATTRS{serial}=="FTVJWQQZ" OWNER="nico" GROUP="users" SYMLINK+="smeter"
SUBSYSTEM=="tty" ATTRS{idVendor}=="067b" ATTRS{idProduct}=="2303" OWNER="nico" GROUP="ysers" SYMLINK+="gsmmodem"
Borgso
Starting Member
Starting Member
Posts: 5
Joined: Thu Nov 21, 2013 4:24 pm

Re: /dev/ttyUSB0,1,2 force a device

Post by Borgso »

Sorry for necro topic, but some extra info around this problem:

On boot its first come, first served what USBTTY number device get.
And its not fixed what devices get detected first by the usb controller.

Atleast on Ubuntu you can find the full path if you type "ls -ld /dev/serial/by-id/*" in shell
This will give you something like this:

Code: Select all

$ ls -ld /dev/serial/by-id/*
lrwxrwxrwx 1 root root 13 Apr  9 22:28 /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_AH01xxxx-if00-port0 -> ../../ttyUSB1
lrwxrwxrwx 1 root root 13 Apr  9 22:28 /dev/serial/by-id/usb-RFXCOM_RFXtrx433_A1Xxxxxx-if00-port0 -> ../../ttyUSB0
This path does not change on reboot,unplug etc. It also contains serialnumber on the USB device.
If you reconnect device after booted, you may need to disable/enable device in domotiga.
Post Reply

Return to “Linux Forum”