Page 1 of 1
Help with making /dev/ttyACM[X] persistent?
Posted: Monday 09 January 2017 23:40
by Nautilus
Hi,
I tried the wiki instructions for persistent USB devices, did some googling after that as well, but no results in making a symlink to /dev/ttyACM0 or /dev/ttyACM1 (don't know why but I do not have any /dev/ttyUSB). I have Gen5 Z-stick and RFLink hooked up to Raspberry's USB ports and they tend to switch places. Output of "udevadm info -a -n /dev/ttyACM0":
Code: Select all
looking at device '/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4/1-1.4:1.0/tty/ttyACM0':
KERNEL=="ttyACM0"
SUBSYSTEM=="tty"
DRIVER==""
looking at parent device '/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4/1-1.4:1.0':
KERNELS=="1-1.4:1.0"
SUBSYSTEMS=="usb"
DRIVERS=="cdc_acm"
ATTRS{bInterfaceClass}=="02"
ATTRS{bmCapabilities}=="0"
ATTRS{bInterfaceSubClass}=="02"
ATTRS{bInterfaceProtocol}=="01"
ATTRS{bNumEndpoints}=="01"
ATTRS{supports_autosuspend}=="0"
ATTRS{bAlternateSetting}==" 0"
ATTRS{bInterfaceNumber}=="00"
looking at parent device '/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4':
KERNELS=="1-1.4"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{bDeviceSubClass}=="00"
ATTRS{bDeviceProtocol}=="00"
ATTRS{devpath}=="1.4"
ATTRS{idVendor}=="0658"
ATTRS{speed}=="12"
ATTRS{bNumInterfaces}==" 2"
ATTRS{bConfigurationValue}=="1"
ATTRS{bMaxPacketSize0}=="8"
ATTRS{busnum}=="1"
ATTRS{devnum}=="4"
ATTRS{configuration}==""
ATTRS{bMaxPower}=="100mA"
ATTRS{authorized}=="1"
ATTRS{bmAttributes}=="80"
ATTRS{bNumConfigurations}=="1"
ATTRS{maxchild}=="0"
ATTRS{bcdDevice}=="0000"
ATTRS{avoid_reset_quirk}=="0"
ATTRS{quirks}=="0x0"
ATTRS{version}==" 2.00"
ATTRS{urbnum}=="1799"
ATTRS{ltm_capable}=="no"
ATTRS{removable}=="removable"
ATTRS{idProduct}=="0200"
ATTRS{bDeviceClass}=="02"
which continues with:
- Spoiler: show
- looking at parent device '/devices/platform/soc/3f980000.usb/usb1/1-1':
KERNELS=="1-1"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{bDeviceSubClass}=="00"
ATTRS{bDeviceProtocol}=="02"
ATTRS{devpath}=="1"
ATTRS{idVendor}=="0424"
ATTRS{speed}=="480"
ATTRS{bNumInterfaces}==" 1"
ATTRS{bConfigurationValue}=="1"
ATTRS{bMaxPacketSize0}=="64"
ATTRS{busnum}=="1"
ATTRS{devnum}=="2"
ATTRS{configuration}==""
ATTRS{bMaxPower}=="2mA"
ATTRS{authorized}=="1"
ATTRS{bmAttributes}=="e0"
ATTRS{bNumConfigurations}=="1"
ATTRS{maxchild}=="5"
ATTRS{bcdDevice}=="0200"
ATTRS{avoid_reset_quirk}=="0"
ATTRS{quirks}=="0x0"
ATTRS{version}==" 2.00"
ATTRS{urbnum}=="45"
ATTRS{ltm_capable}=="no"
ATTRS{removable}=="unknown"
ATTRS{idProduct}=="9514"
ATTRS{bDeviceClass}=="09"
looking at parent device '/devices/platform/soc/3f980000.usb/usb1':
KERNELS=="usb1"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{bDeviceSubClass}=="00"
ATTRS{bDeviceProtocol}=="01"
ATTRS{devpath}=="0"
ATTRS{idVendor}=="1d6b"
ATTRS{speed}=="480"
ATTRS{bNumInterfaces}==" 1"
ATTRS{bConfigurationValue}=="1"
ATTRS{bMaxPacketSize0}=="64"
ATTRS{authorized_default}=="1"
ATTRS{busnum}=="1"
ATTRS{devnum}=="1"
ATTRS{configuration}==""
ATTRS{bMaxPower}=="0mA"
ATTRS{authorized}=="1"
ATTRS{bmAttributes}=="e0"
ATTRS{bNumConfigurations}=="1"
ATTRS{maxchild}=="1"
ATTRS{bcdDevice}=="0401"
ATTRS{avoid_reset_quirk}=="0"
ATTRS{quirks}=="0x0"
ATTRS{serial}=="3f980000.usb"
ATTRS{version}==" 2.00"
ATTRS{urbnum}=="25"
ATTRS{ltm_capable}=="no"
ATTRS{manufacturer}=="Linux 4.1.19-v7+ dwc_otg_hcd"
ATTRS{removable}=="unknown"
ATTRS{idProduct}=="0002"
ATTRS{bDeviceClass}=="09"
ATTRS{product}=="DWC OTG Controller"
looking at parent device '/devices/platform/soc/3f980000.usb':
KERNELS=="3f980000.usb"
SUBSYSTEMS=="platform"
DRIVERS=="dwc_otg"
ATTRS{hnp}=="HstNegScs = 0x0"
ATTRS{srp}=="SesReqScs = 0x1"
ATTRS{regvalue}=="invalid offset"
ATTRS{hsic_connect}=="HSIC Connect = 0x1"
ATTRS{guid}=="GUID = 0x2708a000"
ATTRS{mode}=="Mode = 0x1"
ATTRS{srpcapable}=="SRPCapable = 0x1"
ATTRS{regdump}=="Register Dump"
ATTRS{gpvndctl}=="GPVNDCTL = 0x00000000"
ATTRS{ggpio}=="GGPIO = 0x00000000"
ATTRS{hprt0}=="HPRT0 = 0x00001005"
ATTRS{wr_reg_test}=="Time to write GNPTXFSIZ reg 10000000 times: 620 msecs (62 jiffies)"
ATTRS{driver_override}=="(null)"
ATTRS{hcd_frrem}=="HCD Dump Frame Remaining"
ATTRS{mode_ch_tim_en}=="Mode Change Ready Timer Enable = 0x0"
ATTRS{gnptxfsiz}=="GNPTXFSIZ = 0x01000306"
ATTRS{remote_wakeup}=="Remote Wakeup Sig = 0 Enabled = 0 LPM Remote Wakeup = 0"
ATTRS{busconnected}=="Bus Connected = 0x1"
ATTRS{hcddump}=="HCD Dump"
ATTRS{gotgctl}=="GOTGCTL = 0x001c0001"
ATTRS{spramdump}=="SPRAM Dump"
ATTRS{grxfsiz}=="GRXFSIZ = 0x00000306"
ATTRS{gsnpsid}=="GSNPSID = 0x4f54280a"
ATTRS{gusbcfg}=="GUSBCFG = 0x20001700"
ATTRS{hptxfsiz}=="HPTXFSIZ = 0x02000406"
ATTRS{devspeed}=="Device Speed = 0x0"
ATTRS{fr_interval}=="Frame Interval = 0x1d4c"
ATTRS{rem_wakeup_pwrdn}==""
ATTRS{bussuspend}=="Bus Suspend = 0x0"
ATTRS{buspower}=="Bus Power = 0x1"
ATTRS{hnpcapable}=="HNPCapable = 0x1"
ATTRS{rd_reg_test}=="Time to read GNPTXFSIZ reg 10000000 times: 1410 msecs (141 jiffies)"
ATTRS{enumspeed}=="Device Enumeration Speed = 0x1"
ATTRS{inv_sel_hsic}=="Invert Select HSIC = 0x0"
ATTRS{regoffset}=="0xffffffff"
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==""
It looks like the parameters are like in the wiki example: Gen5: SUBSYSTEM=="tty", ATTRS{idVendor}=="0658", ATTRS{idProduct}=="0200", SYMLINK+="ttyUSB-ZStick-5G" But adding this to file in /etc/udev/rules.d/99-usb-serial.rules does not seem to create any symlinks. Should the file name be something different for ACMX paths, do I perhaps need to add some parameters (iSerial mentioned in wiki but not used). Can anyone tell what I'm missing?
Thanks!
Re: Help with making /dev/ttyACM[X] persistent?
Posted: Tuesday 17 January 2017 12:03
by Nautilus
Haven't still been able to figure this out (well, pretty much gave up on it, guess my Googling skills are not up to par with this). No one here with the same issue and perhaps some solution / workaround?
Re: Help with making /dev/ttyACM[X] persistent?
Posted: Wednesday 18 January 2017 20:38
by Sappien
Try
SUBSYSTEM=="tty", ATTRS{idVendor}=="0658", ATTRS{idProduct}=="0200", SYMLINK+="ttyUSB-RFLink"
Re: Help with making /dev/ttyACM[X] persistent?
Posted: Wednesday 18 January 2017 21:30
by Nautilus
Thanks for the reply!
Sappien wrote:SYMLINK+="ttyUSB-RFLink"
Does the symlink name really play a role here, thought it was just what I wanted the new name be? Otherwise I think it is exactly the same as I already had. But will try in any case...
Re: Help with making /dev/ttyACM[X] persistent?
Posted: Wednesday 18 January 2017 22:38
by Sappien
You can choose any name you like
Re: Help with making /dev/ttyACM[X] persistent?
Posted: Wednesday 18 January 2017 22:43
by Nautilus
Sappien wrote:You can choose any name you like
Yes, that is what I assumed. In this case I don't quite get why you suggest trying the same as I have already tried...
But thanks for looking into it anyhow!
Re: Help with making /dev/ttyACM[X] persistent?
Posted: Wednesday 18 January 2017 22:49
by Sappien
I didn't checked your rule (A)
I did a copy from my rule and changed the vendor
Re: Help with making /dev/ttyACM[X] persistent?
Posted: Wednesday 18 January 2017 22:55
by Nautilus
Sappien wrote:
I didn't checked your rule (A)
I did a copy from my rule and changed the vendor
No problem, will keep looking for the solution
Btw, is your device under ttyACM or ttyUSB? Wondering if anyone has this working with ttyACM...
Re: Help with making /dev/ttyACM[X] persistent?
Posted: Wednesday 18 January 2017 23:02
by Sappien
ttyACM
Re: Help with making /dev/ttyACM[X] persistent?
Posted: Wednesday 18 January 2017 23:09
by Nautilus
Sappien wrote:ttyACM
Sappien wrote:You can choose any name you like
Nautilus wrote:Does the symlink name really play a role here, thought it was just what I wanted the new name be? Otherwise I think it is exactly the same as I already had. But will try in any case...
Well well, I (we?) stand corrected. Believe me, I had tried with a couple of Symlink names and have rebooted the Pi several times. But it wasn't until I changed the name to exactly it is on the wiki, i.e. SYMLINK+="ttyUSB-ZStick-5G" it came up there as a selection. Great!
Not sure if it was just some weirdness / bad luck and it would now work with some other name as well. But who cares, just happy that it works!
Re: Help with making /dev/ttyACM[X] persistent?
Posted: Friday 20 January 2017 21:12
by Sappien
Re: Help with making /dev/ttyACM[X] persistent?
Posted: Wednesday 31 May 2017 13:39
by kman
Nautilus wrote:Sappien wrote:ttyACM
Sappien wrote:You can choose any name you like
Nautilus wrote:Does the symlink name really play a role here, thought it was just what I wanted the new name be? Otherwise I think it is exactly the same as I already had. But will try in any case...
Well well, I (we?) stand corrected. Believe me, I had tried with a couple of Symlink names and have rebooted the Pi several times. But it wasn't until I changed the name to exactly it is on the wiki, i.e. SYMLINK+="ttyUSB-ZStick-5G" it came up there as a selection. Great!
Not sure if it was just some weirdness / bad luck and it would now work with some other name as well. But who cares, just happy that it works!
Thanks Nautilus - this helped. I had the exact problem - to start (i.e. first time) with it seems to work only with "ttyUSB-ZStick-5G". (I have not experimented with LENGTH of characters etc.)
Subsequently, you could change the SYMLINK to "zwave" or something else. But if you started with "zwave" as the SYMLINK, it doesn't work! (funny - can't say it better than Nautilus - "...who cares, just happy it works":)
Re: Help with making /dev/ttyACM[X] persistent?
Posted: Wednesday 31 May 2017 15:56
by kman
kman wrote:Nautilus wrote:Sappien wrote:ttyACM
Sappien wrote:You can choose any name you like
Nautilus wrote:Does the symlink name really play a role here, thought it was just what I wanted the new name be? Otherwise I think it is exactly the same as I already had. But will try in any case...
Well well, I (we?) stand corrected. Believe me, I had tried with a couple of Symlink names and have rebooted the Pi several times. But it wasn't until I changed the name to exactly it is on the wiki, i.e. SYMLINK+="ttyUSB-ZStick-5G" it came up there as a selection. Great!
Not sure if it was just some weirdness / bad luck and it would now work with some other name as well. But who cares, just happy that it works!
Thanks Nautilus - this helped. I had the exact problem - to start (i.e. first time) with it seems to work only with "ttyUSB-ZStick-5G". (I have not experimented with LENGTH of characters etc.)
Subsequently, you could change the SYMLINK to "zwave" or something else. But if you started with "zwave" as the SYMLINK, it doesn't work! (funny - can't say it better than Nautilus - "...who cares, just happy it works":)
BTW you wouldn't want to have any other SYMLINK other than "ttyUSB-ZStick-5G" - because say if you had used "zwave" as the SYMLINK, I don't see this listed in the drop down list of domoticz->Hardware->Serial Port for OpenZwave USB - whereas "ttyUSB-ZStick-5G" does get listed.
Re: Help with making /dev/ttyACM[X] persistent?
Posted: Wednesday 31 May 2017 23:16
by Nautilus
kman wrote:Subsequently, you could change the SYMLINK to "zwave" or something else.
kman wrote:
BTW you wouldn't want to have any other SYMLINK other than "ttyUSB-ZStick-5G" - because say if you had used "zwave" as the SYMLINK, I don't see this listed in the drop down list of domoticz->Hardware->Serial Port for OpenZwave USB - whereas "ttyUSB-ZStick-5G" does get listed.
So, it did not work after renaming it to something else from the "working" naming? Because that is how I understood the first quote
In any case, good that you got it working in one way or the other...
Re: Help with making /dev/ttyACM[X] persistent?
Posted: Saturday 10 June 2017 9:58
by kman
Nautilus wrote:kman wrote:Subsequently, you could change the SYMLINK to "zwave" or something else.
kman wrote:
BTW you wouldn't want to have any other SYMLINK other than "ttyUSB-ZStick-5G" - because say if you had used "zwave" as the SYMLINK, I don't see this listed in the drop down list of domoticz->Hardware->Serial Port for OpenZwave USB - whereas "ttyUSB-ZStick-5G" does get listed.
So, it did not work after renaming it to something else from the "working" naming? Because that is how I understood the first quote
In any case, good that you got it working in one way or the other...
No, they are not exactly the same issues:
1. In the first case, using "zwave" as the SYMLINK, doesn't create the symlink under /dev/. So, to start with i.e. the for the very first time when you are creating a symlink, you will have to use "ttyUSB-ZStick-5G" (or something else, as I have not tested with bigger character length) as your SYMLINK.
2. In the second case, as I have said earlier, after you have used "ttyUSB-ZStick-5G" as the SYMLINK (this appears under /dev/), now rename "ttyUSB-ZStick-5G" to "zwave" in the /etc/udev/ruled.d/<rules_file>, now "zwave" appears under /dev/. i.e. the SYMLINK for "zwave" is created. But now proceed to domoticz->Hardware->Serial Port, but you wouldn't find "zwave" listed. Hence better to leave it at "ttyUSB-ZStick-5G".
Re: Help with making /dev/ttyACM[X] persistent?
Posted: Monday 07 August 2017 12:38
by PeterHarrie
Thanks all, I have successfully assigned the port.
What I was wondering... can I now also unplug and replug the device (ZWave-stick) in a different usb-port so that it still works?
Re: Help with making /dev/ttyACM[X] persistent?
Posted: Tuesday 08 August 2017 21:08
by PeterHarrie
I stand corrected... I cannot get it to work properly. I thought I had it, but after a reboot my port has disappeared. Renaming the file '99-usb-serial.rules' to 99-usb-serial.rules.old' still failes to show my 'old' ttyACM0 port.
So after a reboot I am completely unable to activate my Z-Wave stick.
Re: Help with making /dev/ttyACM[X] persistent?
Posted: Wednesday 09 August 2017 11:30
by PeterHarrie
Pfffff.... looks like a faulty USB cable, what are the odds.
Replaced the cable and everything seems to work fine now.
Re: Help with making /dev/ttyACM[X] persistent?
Posted: Monday 14 August 2017 14:08
by briped
I'm not a programmer, so this is based on my ability to read C++ code (GetSerialPorts in Helper.cpp)
In regards to udev rules, you can name the symlink anything you want. HOWEVER, in regards to Domoticz, the symlink name must begin with one of the following:
- ttyUSB
- tty.usbserial
- ttyACM
- ttySAC
- ttyU
- cuaU(?)
Reading the Helper.cpp, according to the helpful comment, they first limit to character devices and symbolic links. Then they further limit using the before mentioned device-/filenames. This got my thinking. Why not only do the name-based filtering on only character devices, and simply show all symlinks?
Now, these UDEV rules works for me, and as you can see, you can create as many (unique) symlinks to your device as you want (I created two; ACM and USB, just for demonstration purposes).
Code: Select all
echo "SUBSYSTEM==\"tty\", ATTRS{idVendor}==\"0403\", ATTRS{idProduct}==\"6001\", ATTRS{serial}==\"XXXXXXXX\", SYMLINK+=\"ttyUSB-RFXtrx433E-1\"" | sudo tee -a /etc/udev/rules.d/99-usb-serial.rules
echo "SUBSYSTEM==\"tty\", ATTRS{idVendor}==\"0658\", ATTRS{idProduct}==\"0200\", SYMLINK+=\"ttyACM-ZStick-5G-1\"" | sudo tee -a /etc/udev/rules.d/99-usb-serial.rules
echo "SUBSYSTEM==\"tty\", ATTRS{idVendor}==\"0658\", ATTRS{idProduct}==\"0200\", SYMLINK+=\"ttyUSB-ZStick-5G-1\"" | sudo tee -a /etc/udev/rules.d/99-usb-serial.rules
user@host:~$ cat /etc/udev/rules.d/99-usb-serial.rules
Code: Select all
SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ATTRS{serial}=="XXXXXXXX", SYMLINK+="ttyUSB-RFXtrx433E-1"
SUBSYSTEM=="tty", ATTRS{idVendor}=="0658", ATTRS{idProduct}=="0200", SYMLINK+="ttyACM-ZStick-5G-1"
SUBSYSTEM=="tty", ATTRS{idVendor}=="0658", ATTRS{idProduct}=="0200", SYMLINK+="ttyUSB-ZStick-5G-1"
user@host:~$ ls -al /dev/ttyA* /dev/ttyU*
Code: Select all
crw-rw---- 1 root dialout 166, 0 Aug 14 13:35 /dev/ttyACM0
lrwxrwxrwx 1 root root 7 Aug 14 13:35 /dev/ttyACM-ZStick-5G-1 -> ttyACM0
crw-rw---- 1 root dialout 188, 0 Aug 14 13:35 /dev/ttyUSB0
lrwxrwxrwx 1 root root 7 Aug 14 13:35 /dev/ttyUSB-RFXtrx433E-1 -> ttyUSB0
lrwxrwxrwx 1 root root 7 Aug 14 13:35 /dev/ttyUSB-ZStick-5G-1 -> ttyACM0