Help with making /dev/ttyACM[X] persistent?

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
Nautilus
Posts: 722
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Finland
Contact:

Help with making /dev/ttyACM[X] persistent?

Post 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! :)
Nautilus
Posts: 722
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Finland
Contact:

Re: Help with making /dev/ttyACM[X] persistent?

Post 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? :)
Sappien
Posts: 114
Joined: Saturday 24 August 2013 9:59
Target OS: Linux
Domoticz version: beta
Contact:

Re: Help with making /dev/ttyACM[X] persistent?

Post by Sappien »

Try

SUBSYSTEM=="tty", ATTRS{idVendor}=="0658", ATTRS{idProduct}=="0200", SYMLINK+="ttyUSB-RFLink"
Nautilus
Posts: 722
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Finland
Contact:

Re: Help with making /dev/ttyACM[X] persistent?

Post 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...
Sappien
Posts: 114
Joined: Saturday 24 August 2013 9:59
Target OS: Linux
Domoticz version: beta
Contact:

Re: Help with making /dev/ttyACM[X] persistent?

Post by Sappien »

You can choose any name you like
Nautilus
Posts: 722
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Finland
Contact:

Re: Help with making /dev/ttyACM[X] persistent?

Post 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... :D But thanks for looking into it anyhow! :)
Sappien
Posts: 114
Joined: Saturday 24 August 2013 9:59
Target OS: Linux
Domoticz version: beta
Contact:

Re: Help with making /dev/ttyACM[X] persistent?

Post by Sappien »

:geek:

I didn't checked your rule (A)

I did a copy from my rule and changed the vendor :roll:
Nautilus
Posts: 722
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Finland
Contact:

Re: Help with making /dev/ttyACM[X] persistent?

Post by Nautilus »

Sappien wrote::geek:

I didn't checked your rule (A)

I did a copy from my rule and changed the vendor :roll:
No problem, will keep looking for the solution :) Btw, is your device under ttyACM or ttyUSB? Wondering if anyone has this working with ttyACM...
Sappien
Posts: 114
Joined: Saturday 24 August 2013 9:59
Target OS: Linux
Domoticz version: beta
Contact:

Re: Help with making /dev/ttyACM[X] persistent?

Post by Sappien »

ttyACM
Nautilus
Posts: 722
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Finland
Contact:

Re: Help with making /dev/ttyACM[X] persistent?

Post 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! :D
Sappien
Posts: 114
Joined: Saturday 24 August 2013 9:59
Target OS: Linux
Domoticz version: beta
Contact:

Re: Help with making /dev/ttyACM[X] persistent?

Post by Sappien »

:)
kman
Posts: 78
Joined: Wednesday 30 September 2015 19:33
Target OS: Linux
Domoticz version:
Contact:

Re: Help with making /dev/ttyACM[X] persistent?

Post 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! :D

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":)
kman
Posts: 78
Joined: Wednesday 30 September 2015 19:33
Target OS: Linux
Domoticz version:
Contact:

Re: Help with making /dev/ttyACM[X] persistent?

Post 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! :D

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.
Nautilus
Posts: 722
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Finland
Contact:

Re: Help with making /dev/ttyACM[X] persistent?

Post 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... :D
kman
Posts: 78
Joined: Wednesday 30 September 2015 19:33
Target OS: Linux
Domoticz version:
Contact:

Re: Help with making /dev/ttyACM[X] persistent?

Post 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... :D
:) 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".
PeterHarrie
Posts: 9
Joined: Saturday 07 January 2017 16:05
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Help with making /dev/ttyACM[X] persistent?

Post 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?
PeterHarrie
Posts: 9
Joined: Saturday 07 January 2017 16:05
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Help with making /dev/ttyACM[X] persistent?

Post 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.
Last edited by PeterHarrie on Wednesday 09 August 2017 11:33, edited 1 time in total.
PeterHarrie
Posts: 9
Joined: Saturday 07 January 2017 16:05
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Help with making /dev/ttyACM[X] persistent?

Post by PeterHarrie »

Pfffff.... looks like a faulty USB cable, what are the odds.
Replaced the cable and everything seems to work fine now.
briped
Posts: 3
Joined: Monday 14 August 2017 13:41
Target OS: Linux
Domoticz version:
Contact:

Re: Help with making /dev/ttyACM[X] persistent?

Post by briped »

I'm not a programmer, so this is based on my ability to read C++ code (GetSerialPorts in Helper.cpp) :shock:

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
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest