/dev/ttyUSB0,1,2 force a device

Forum regarding Linux Software and Home Automation Domotica.

/dev/ttyUSB0,1,2 force a device

Postby Kroonen » Fri Dec 07, 2007 4:22 pm

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???
Kroonen
Member
Member
 
Posts: 302
Joined: October 2007
Location: Netherlands

/dev/ttyUSB0,1,2 force a device

Postby Snelvuur » Fri Dec 07, 2007 4:41 pm

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)
User avatar
Snelvuur
Forum Moderator
Forum Moderator
 
Posts: 3155
Joined: April 2007
Location: Netherlands

/dev/ttyUSB0,1,2 force a device

Postby Kroonen » Fri Dec 07, 2007 7:56 pm

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.
Kroonen
Member
Member
 
Posts: 302
Joined: October 2007
Location: Netherlands

/dev/ttyUSB0,1,2 force a device

Postby Snelvuur » Fri Dec 07, 2007 10:06 pm

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)
User avatar
Snelvuur
Forum Moderator
Forum Moderator
 
Posts: 3155
Joined: April 2007
Location: Netherlands

/dev/ttyUSB0,1,2 force a device

Postby Kroonen » Sun Dec 09, 2007 9:37 am

it should be done with udev, in /etc/udev dir. it is not easy, but i searching for it
Kroonen
Member
Member
 
Posts: 302
Joined: October 2007
Location: Netherlands

/dev/ttyUSB0,1,2 force a device

Postby beanz » Sun Feb 10, 2008 9:27 am

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.
beanz
Starting Member
Starting Member
 
Posts: 20
Joined: June 2007
Location: United Kingdom

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

Postby vossie » Sun Jul 01, 2012 10:52 am

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"
User avatar
vossie
Starting Member
Starting Member
 
Posts: 20
Joined: January 2009
Location: Netherlands

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

Postby Borgso » Wed Apr 23, 2014 3:13 pm

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.
Borgso
Starting Member
Starting Member
 
Posts: 5
Joined: November 2013


Return to Linux Forum

Who is online

Users browsing this forum: No registered users and 1 guest

cron