LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-19-2021, 11:40 PM   #1
schmitta
Member
 
Registered: May 2011
Location: Blacksburg VA
Distribution: UBUNTU, LXLE
Posts: 352

Rep: Reputation: Disabled
ftdi USB to RS232 use on Ubuntu Server needing to make ttyUSB0 be used all the time


I have a FTDI usb port to RS232 connection. I need ttyUSB0 to remain available, active and the same every time the Ubuntu server boots as it is a dedicated system to record data. I am not a skilled Linux user. Does Udev change ttyUSB0 in any way or once the device is plugged in (remains plugged it) and is active? Will I be able to be assured that data collection and transmission to the raspberry pi will continue to work after every reboot? I need to be assured of this before I travel 300 miles to do an installation. Thank you for your help.
 
Old 05-20-2021, 04:08 PM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,883
Blog Entries: 13

Rep: Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931
I haven't done it in years, but there is a way to force a device to be enumerated to a specific string and number: https://gist.github.com/edro15/1c6cd...a7d88bef26e4af

That link seems similar to how I previously did this. I used a udev rule.
 
1 members found this post helpful.
Old 05-21-2021, 12:38 AM   #3
schmitta
Member
 
Registered: May 2011
Location: Blacksburg VA
Distribution: UBUNTU, LXLE
Posts: 352

Original Poster
Rep: Reputation: Disabled
Thank you - this is what I am experiencing and I may need to come back to you for help - but this directly answers my question.
 
Old 05-21-2021, 05:32 PM   #4
schmitta
Member
 
Registered: May 2011
Location: Blacksburg VA
Distribution: UBUNTU, LXLE
Posts: 352

Original Poster
Rep: Reputation: Disabled
I tried to enter my own rules but it did not work. I had

ubuntu@ubuntu:~$ lsusb
Bus 001 Device 006: ID 154b:00ee PNY
Bus 001 Device 005: ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter
Bus 001 Device 004: ID 0403:6001 Future Technology Devices International, Ltd FT232 Serial (UART) IC
Bus 001 Device 003: ID 0424:ec00 Microchip Technology, Inc. (formerly SMSC) SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Microchip Technology, Inc. (formerly SMSC) SMC9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
ubuntu@ubuntu:~$

I need device 4 to go from ttyUSB0 to ttyLAN

I did

ubuntu@ubuntu:~$ udevadm info -a -p $(udevadm info -q path -n /dev/ttyUSB0)

Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

looking at device '/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2/1-1.2:1.0/ttyUSB0/tty/ttyUSB0':
KERNEL=="ttyUSB0"
SUBSYSTEM=="tty"
DRIVER==""

looking at parent device '/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2/1-1.2:1.0/ttyUSB0':
KERNELS=="ttyUSB0"
SUBSYSTEMS=="usb-serial"
DRIVERS=="ftdi_sio"
ATTRS{port_number}=="0"
ATTRS{latency_timer}=="16"

looking at parent device '/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2/1-1.2:1.0':
KERNELS=="1-1.2:1.0"
SUBSYSTEMS=="usb"
DRIVERS=="ftdi_sio"
ATTRS{bInterfaceClass}=="ff"
ATTRS{interface}=="FT232R USB UART"
ATTRS{supports_autosuspend}=="1"
ATTRS{bInterfaceProtocol}=="ff"
ATTRS{bNumEndpoints}=="02"
ATTRS{bInterfaceSubClass}=="ff"
ATTRS{authorized}=="1"
ATTRS{bAlternateSetting}==" 0"
ATTRS{bInterfaceNumber}=="00"

looking at parent device '/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2':
KERNELS=="1-1.2"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{busnum}=="1"
ATTRS{bmAttributes}=="a0"
ATTRS{bcdDevice}=="0600"
ATTRS{bDeviceSubClass}=="00"
ATTRS{ltm_capable}=="no"
ATTRS{manufacturer}=="FTDI"
ATTRS{bNumConfigurations}=="1"
ATTRS{bMaxPacketSize0}=="8"
ATTRS{quirks}=="0x0"
ATTRS{speed}=="12"
ATTRS{idProduct}=="6001"
ATTRS{urbnum}=="17"
ATTRS{maxchild}=="0"
ATTRS{rx_lanes}=="1"
ATTRS{bConfigurationValue}=="1"
ATTRS{avoid_reset_quirk}=="0"
ATTRS{tx_lanes}=="1"
ATTRS{devnum}=="4"
ATTRS{version}==" 2.00"
ATTRS{devspec}=="(null)"
ATTRS{bNumInterfaces}==" 1"
ATTRS{authorized}=="1"
ATTRS{serial}=="AQ00UNI1"
ATTRS{devpath}=="1.2"
ATTRS{bDeviceClass}=="00"
ATTRS{bDeviceProtocol}=="00"
ATTRS{bMaxPower}=="90mA"
ATTRS{removable}=="removable"
ATTRS{product}=="FT232R USB UART"
ATTRS{idVendor}=="0403"
ATTRS{configuration}==""

looking at parent device '/devices/platform/soc/3f980000.usb/usb1/1-1':
KERNELS=="1-1"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{bcdDevice}=="0200"
ATTRS{bNumConfigurations}=="1"
ATTRS{bDeviceSubClass}=="00"
ATTRS{bDeviceClass}=="09"
ATTRS{urbnum}=="392"
ATTRS{rx_lanes}=="1"
ATTRS{bConfigurationValue}=="1"
ATTRS{configuration}==""
ATTRS{devpath}=="1"
ATTRS{maxchild}=="5"
ATTRS{ltm_capable}=="no"
ATTRS{bDeviceProtocol}=="02"
ATTRS{bMaxPacketSize0}=="64"
ATTRS{quirks}=="0x0"
ATTRS{version}==" 2.00"
ATTRS{devnum}=="2"
ATTRS{idVendor}=="0424"
ATTRS{bNumInterfaces}==" 1"
ATTRS{speed}=="480"
ATTRS{idProduct}=="9514"
ATTRS{busnum}=="1"
ATTRS{tx_lanes}=="1"
ATTRS{removable}=="unknown"
ATTRS{avoid_reset_quirk}=="0"
ATTRS{bMaxPower}=="2mA"
ATTRS{bmAttributes}=="e0"
ATTRS{authorized}=="1"

looking at parent device '/devices/platform/soc/3f980000.usb/usb1':
KERNELS=="usb1"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{bMaxPower}=="0mA"
ATTRS{bConfigurationValue}=="1"
ATTRS{authorized}=="1"
ATTRS{idProduct}=="0002"
ATTRS{ltm_capable}=="no"
ATTRS{configuration}==""
ATTRS{bmAttributes}=="e0"
ATTRS{bDeviceClass}=="09"
ATTRS{product}=="DWC OTG Controller"
ATTRS{interface_authorized_default}=="1"
ATTRS{bNumInterfaces}==" 1"
ATTRS{bMaxPacketSize0}=="64"
ATTRS{version}==" 2.00"
ATTRS{tx_lanes}=="1"
ATTRS{devpath}=="0"
ATTRS{busnum}=="1"
ATTRS{speed}=="480"
ATTRS{bDeviceSubClass}=="00"
ATTRS{bcdDevice}=="0504"
ATTRS{manufacturer}=="Linux 5.4.0-1035-raspi dwc_otg_hcd"
ATTRS{rx_lanes}=="1"
ATTRS{urbnum}=="25"
ATTRS{devnum}=="1"
ATTRS{idVendor}=="1d6b"
ATTRS{bNumConfigurations}=="1"
ATTRS{maxchild}=="1"
ATTRS{quirks}=="0x0"
ATTRS{authorized_default}=="1"
ATTRS{avoid_reset_quirk}=="0"
ATTRS{bDeviceProtocol}=="01"
ATTRS{removable}=="unknown"
ATTRS{serial}=="3f980000.usb"

looking at parent device '/devices/platform/soc/3f980000.usb':
KERNELS=="3f980000.usb"
SUBSYSTEMS=="platform"
DRIVERS=="dwc_otg"
ATTRS{rem_wakeup_pwrdn}==""
ATTRS{wr_reg_test}=="Time to write GNPTXFSIZ reg 10000000 times: 344 msecs (86 jiffies)"
ATTRS{gotgctl}=="GOTGCTL = 0x001c0001"
ATTRS{hprt0}=="HPRT0 = 0x00001005"
ATTRS{mode_ch_tim_en}=="Mode Change Ready Timer Enable = 0x0"
ATTRS{ggpio}=="GGPIO = 0x00000000"
ATTRS{hsic_connect}=="HSIC Connect = 0x1"
ATTRS{buspower}=="Bus Power = 0x1"
ATTRS{rd_reg_test}=="Time to read GNPTXFSIZ reg 10000000 times: 932 msecs (233 jiffies)"
ATTRS{spramdump}=="SPRAM Dump"
ATTRS{fr_interval}=="Frame Interval = 0x1d4b"
ATTRS{driver_override}=="(null)"
ATTRS{gpvndctl}=="GPVNDCTL = 0x00000000"
ATTRS{srpcapable}=="SRPCapable = 0x1"
ATTRS{hcddump}=="HCD Dump"
ATTRS{hptxfsiz}=="HPTXFSIZ = 0x02000314"
ATTRS{guid}=="GUID = 0x2708a000"
ATTRS{gusbcfg}=="GUSBCFG = 0x20001700"
ATTRS{gsnpsid}=="GSNPSID = 0x4f54280a"
ATTRS{devspeed}=="Device Speed = 0x0"
ATTRS{enumspeed}=="Device Enumeration Speed = 0x1"
ATTRS{remote_wakeup}=="Remote Wakeup Sig = 0 Enabled = 0 LPM Remote Wakeup = 0"
ATTRS{regvalue}=="invalid offset"
ATTRS{regoffset}=="0xffffffff"
ATTRS{hnp}=="HstNegScs = 0x0"
ATTRS{inv_sel_hsic}=="Invert Select HSIC = 0x0"
ATTRS{hcd_frrem}=="HCD Dump Frame Remaining"
ATTRS{gnptxfsiz}=="GNPTXFSIZ = 0x01000214"
ATTRS{busconnected}=="Bus Connected = 0x1"
ATTRS{grxfsiz}=="GRXFSIZ = 0x00000214"
ATTRS{hnpcapable}=="HNPCapable = 0x1"
ATTRS{bussuspend}=="Bus Suspend = 0x0"
ATTRS{srp}=="SesReqScs = 0x1"
ATTRS{mode}=="Mode = 0x1"
ATTRS{regdump}=="Register Dump"

looking at parent device '/devices/platform/soc':
KERNELS=="soc"
SUBSYSTEMS=="platform"
DRIVERS==""
ATTRS{driver_override}=="(null)"

looking at parent device '/devices/platform':
KERNELS=="platform"
SUBSYSTEMS==""
DRIVERS==""

ubuntu@ubuntu:~$

my 49-my.rules contained:

ubuntu@ubuntu:~$ cat /etc/udev/rules.d/49-my.rules
#Future Technologies Devices International, Ltd FT232 Serial UART
KERNAL=="ttyUSB{0-9]*", SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", SYMLINK=="ttyLAN"

ubuntu@ubuntu:~$

in the example SYMLINK had only one = . I will try it with one.

the printout said:

Hence, services/programs configurations must be setup accordingly.
Considering the GPS case, make sure the configuration file
(/etc/sysconfig/gpsd or /etc/default/gpsd) contains the following
line: DEVICE="/dev/ttyGPS"

but there were no /etc/sysconfig/ftdid or /etc/default/ftdid files.

it did not work with one = sign.

I will try to find the appropriate log files for errors but I do not know much about linux. Please help me. Thank you.
 
Old 05-21-2021, 06:54 PM   #5
schmitta
Member
 
Registered: May 2011
Location: Blacksburg VA
Distribution: UBUNTU, LXLE
Posts: 352

Original Poster
Rep: Reputation: Disabled
I did:
ubuntu@ubuntu:/etc/udev/rules.d$ dir
49-my.rules 70-snap.snapd.rules
ubuntu@ubuntu:/etc/udev/rules.d$ cat 49-my.rules
#Future Technologies Devices International, Ltd FT2
SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", SYMLINK+="ttyFDTI%s{devpath}"
EOT




I got :
^Cubuntu@ubuntu:~ls -al /dev/tty* | grep USB
lrwxrwxrwx 1 root root 7 Mar 17 17:37 /dev/ttyFDTI1.2 -> ttyUSB0
crw-rw---- 1 root dialout 188, 0 Mar 17 17:37 /dev/ttyUSB0
ubuntu@ubuntu:~$

but does it remain and have to be done every time?
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
FTDI FT2232H time related setting issue... JayminD Programming 0 02-20-2015 11:45 AM
FTDI FT2232H time setting issue JayminD Linux - Software 0 02-19-2015 12:44 PM
ttyUSB0 not found | no driver ftdi-sio XTC0r Linux - Hardware 2 01-27-2015 04:24 PM
Connecting to an RS232 without an RS232 timnp Linux - General 6 06-06-2008 03:53 PM
USB>RS232 versus PCMCIA>RS232 jayhel Linux - Laptop and Netbook 2 08-04-2005 06:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:21 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration