udev rule with KERNELS argument does not work

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I'm using a USB <-> Serial box and would like to have a custom symlink for the serial ports.



Based on the output of udevadm I know each port has a different KERNELS value:



KERNELS=="1-3:1.0" (this is labeled as port 1 on the box)
KERNELS=="1-3:1.1" (port 2)
KERNELS=="1-3:1.2" (port 3)
KERNELS=="1-3:1.3" (port 4)


I tried the following rule:



ATTRSidVendor=="0403", ATTRSidProduct=="6011", KERNELS=="1-3:1.3", SYMLINK+="my_port"


which did not work. If, however, I use KERNELS=="1-3" instead of KERNELS=="1-3:1.3", the symlink is created.



How can I rewrite the rule to be able to differentiate between the various serial ports?



 $ udevadm info --path=/sys/bus/usb-serial/devices/ttyUSB19 --attribute-walk

looking at device '/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.3/ttyUSB19':
KERNEL=="ttyUSB19"
SUBSYSTEM=="usb-serial"
DRIVER=="ftdi_sio"
ATTRlatency_timer=="16"
ATTRport_number=="0"

looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.3':
KERNELS=="1-3:1.3"
SUBSYSTEMS=="usb"
DRIVERS=="ftdi_sio"
ATTRSauthorized=="1"
ATTRSbAlternateSetting==" 0"
ATTRSbInterfaceClass=="ff"
ATTRSbInterfaceNumber=="03"
ATTRSbInterfaceProtocol=="ff"
ATTRSbInterfaceSubClass=="ff"
ATTRSbNumEndpoints=="02"
ATTRSinterface=="USB <-> Serial Cable"
ATTRSsupports_autosuspend=="1"

looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1/1-3':
KERNELS=="1-3"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRSauthorized=="1"
ATTRSavoid_reset_quirk=="0"
ATTRSbConfigurationValue=="1"
ATTRSbDeviceClass=="00"
ATTRSbDeviceProtocol=="00"
ATTRSbDeviceSubClass=="00"
ATTRSbMaxPacketSize0=="64"
ATTRSbMaxPower=="100mA"
ATTRSbNumConfigurations=="1"
ATTRSbNumInterfaces==" 4"
ATTRSbcdDevice=="0800"
ATTRSbmAttributes=="80"
ATTRSbusnum=="1"
ATTRSconfiguration==""
ATTRSdevnum=="65"
ATTRSdevpath=="3"
ATTRSidProduct=="6011"
ATTRSidVendor=="0403"
ATTRSltm_capable=="no"
ATTRSmanufacturer=="FTDI"
[...]






share|improve this question



















  • At KERNELS=="1-3", you probably get a symlink to the raw USB device instead of the tty. You need to match on SUBSYSTEM=="usb-serial" (or whatever subsystem actually produces the tty). This question is a duplicate, and has been asked before in several variants, but I don't have the time to find the old question(s) right now.
    – dirkt
    Jun 6 at 11:50










  • @dirkt I am aware of that. But matching with subsystem is not enough because all the serial ports have the same, "1-3". I was suspecting that the colon is the source of trouble: why does it work for "1-3" but not for "1-3:1.3"?
    – Sparkler
    Jun 6 at 12:37















up vote
0
down vote

favorite












I'm using a USB <-> Serial box and would like to have a custom symlink for the serial ports.



Based on the output of udevadm I know each port has a different KERNELS value:



KERNELS=="1-3:1.0" (this is labeled as port 1 on the box)
KERNELS=="1-3:1.1" (port 2)
KERNELS=="1-3:1.2" (port 3)
KERNELS=="1-3:1.3" (port 4)


I tried the following rule:



ATTRSidVendor=="0403", ATTRSidProduct=="6011", KERNELS=="1-3:1.3", SYMLINK+="my_port"


which did not work. If, however, I use KERNELS=="1-3" instead of KERNELS=="1-3:1.3", the symlink is created.



How can I rewrite the rule to be able to differentiate between the various serial ports?



 $ udevadm info --path=/sys/bus/usb-serial/devices/ttyUSB19 --attribute-walk

looking at device '/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.3/ttyUSB19':
KERNEL=="ttyUSB19"
SUBSYSTEM=="usb-serial"
DRIVER=="ftdi_sio"
ATTRlatency_timer=="16"
ATTRport_number=="0"

looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.3':
KERNELS=="1-3:1.3"
SUBSYSTEMS=="usb"
DRIVERS=="ftdi_sio"
ATTRSauthorized=="1"
ATTRSbAlternateSetting==" 0"
ATTRSbInterfaceClass=="ff"
ATTRSbInterfaceNumber=="03"
ATTRSbInterfaceProtocol=="ff"
ATTRSbInterfaceSubClass=="ff"
ATTRSbNumEndpoints=="02"
ATTRSinterface=="USB <-> Serial Cable"
ATTRSsupports_autosuspend=="1"

looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1/1-3':
KERNELS=="1-3"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRSauthorized=="1"
ATTRSavoid_reset_quirk=="0"
ATTRSbConfigurationValue=="1"
ATTRSbDeviceClass=="00"
ATTRSbDeviceProtocol=="00"
ATTRSbDeviceSubClass=="00"
ATTRSbMaxPacketSize0=="64"
ATTRSbMaxPower=="100mA"
ATTRSbNumConfigurations=="1"
ATTRSbNumInterfaces==" 4"
ATTRSbcdDevice=="0800"
ATTRSbmAttributes=="80"
ATTRSbusnum=="1"
ATTRSconfiguration==""
ATTRSdevnum=="65"
ATTRSdevpath=="3"
ATTRSidProduct=="6011"
ATTRSidVendor=="0403"
ATTRSltm_capable=="no"
ATTRSmanufacturer=="FTDI"
[...]






share|improve this question



















  • At KERNELS=="1-3", you probably get a symlink to the raw USB device instead of the tty. You need to match on SUBSYSTEM=="usb-serial" (or whatever subsystem actually produces the tty). This question is a duplicate, and has been asked before in several variants, but I don't have the time to find the old question(s) right now.
    – dirkt
    Jun 6 at 11:50










  • @dirkt I am aware of that. But matching with subsystem is not enough because all the serial ports have the same, "1-3". I was suspecting that the colon is the source of trouble: why does it work for "1-3" but not for "1-3:1.3"?
    – Sparkler
    Jun 6 at 12:37













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I'm using a USB <-> Serial box and would like to have a custom symlink for the serial ports.



Based on the output of udevadm I know each port has a different KERNELS value:



KERNELS=="1-3:1.0" (this is labeled as port 1 on the box)
KERNELS=="1-3:1.1" (port 2)
KERNELS=="1-3:1.2" (port 3)
KERNELS=="1-3:1.3" (port 4)


I tried the following rule:



ATTRSidVendor=="0403", ATTRSidProduct=="6011", KERNELS=="1-3:1.3", SYMLINK+="my_port"


which did not work. If, however, I use KERNELS=="1-3" instead of KERNELS=="1-3:1.3", the symlink is created.



How can I rewrite the rule to be able to differentiate between the various serial ports?



 $ udevadm info --path=/sys/bus/usb-serial/devices/ttyUSB19 --attribute-walk

looking at device '/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.3/ttyUSB19':
KERNEL=="ttyUSB19"
SUBSYSTEM=="usb-serial"
DRIVER=="ftdi_sio"
ATTRlatency_timer=="16"
ATTRport_number=="0"

looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.3':
KERNELS=="1-3:1.3"
SUBSYSTEMS=="usb"
DRIVERS=="ftdi_sio"
ATTRSauthorized=="1"
ATTRSbAlternateSetting==" 0"
ATTRSbInterfaceClass=="ff"
ATTRSbInterfaceNumber=="03"
ATTRSbInterfaceProtocol=="ff"
ATTRSbInterfaceSubClass=="ff"
ATTRSbNumEndpoints=="02"
ATTRSinterface=="USB <-> Serial Cable"
ATTRSsupports_autosuspend=="1"

looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1/1-3':
KERNELS=="1-3"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRSauthorized=="1"
ATTRSavoid_reset_quirk=="0"
ATTRSbConfigurationValue=="1"
ATTRSbDeviceClass=="00"
ATTRSbDeviceProtocol=="00"
ATTRSbDeviceSubClass=="00"
ATTRSbMaxPacketSize0=="64"
ATTRSbMaxPower=="100mA"
ATTRSbNumConfigurations=="1"
ATTRSbNumInterfaces==" 4"
ATTRSbcdDevice=="0800"
ATTRSbmAttributes=="80"
ATTRSbusnum=="1"
ATTRSconfiguration==""
ATTRSdevnum=="65"
ATTRSdevpath=="3"
ATTRSidProduct=="6011"
ATTRSidVendor=="0403"
ATTRSltm_capable=="no"
ATTRSmanufacturer=="FTDI"
[...]






share|improve this question











I'm using a USB <-> Serial box and would like to have a custom symlink for the serial ports.



Based on the output of udevadm I know each port has a different KERNELS value:



KERNELS=="1-3:1.0" (this is labeled as port 1 on the box)
KERNELS=="1-3:1.1" (port 2)
KERNELS=="1-3:1.2" (port 3)
KERNELS=="1-3:1.3" (port 4)


I tried the following rule:



ATTRSidVendor=="0403", ATTRSidProduct=="6011", KERNELS=="1-3:1.3", SYMLINK+="my_port"


which did not work. If, however, I use KERNELS=="1-3" instead of KERNELS=="1-3:1.3", the symlink is created.



How can I rewrite the rule to be able to differentiate between the various serial ports?



 $ udevadm info --path=/sys/bus/usb-serial/devices/ttyUSB19 --attribute-walk

looking at device '/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.3/ttyUSB19':
KERNEL=="ttyUSB19"
SUBSYSTEM=="usb-serial"
DRIVER=="ftdi_sio"
ATTRlatency_timer=="16"
ATTRport_number=="0"

looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.3':
KERNELS=="1-3:1.3"
SUBSYSTEMS=="usb"
DRIVERS=="ftdi_sio"
ATTRSauthorized=="1"
ATTRSbAlternateSetting==" 0"
ATTRSbInterfaceClass=="ff"
ATTRSbInterfaceNumber=="03"
ATTRSbInterfaceProtocol=="ff"
ATTRSbInterfaceSubClass=="ff"
ATTRSbNumEndpoints=="02"
ATTRSinterface=="USB <-> Serial Cable"
ATTRSsupports_autosuspend=="1"

looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1/1-3':
KERNELS=="1-3"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRSauthorized=="1"
ATTRSavoid_reset_quirk=="0"
ATTRSbConfigurationValue=="1"
ATTRSbDeviceClass=="00"
ATTRSbDeviceProtocol=="00"
ATTRSbDeviceSubClass=="00"
ATTRSbMaxPacketSize0=="64"
ATTRSbMaxPower=="100mA"
ATTRSbNumConfigurations=="1"
ATTRSbNumInterfaces==" 4"
ATTRSbcdDevice=="0800"
ATTRSbmAttributes=="80"
ATTRSbusnum=="1"
ATTRSconfiguration==""
ATTRSdevnum=="65"
ATTRSdevpath=="3"
ATTRSidProduct=="6011"
ATTRSidVendor=="0403"
ATTRSltm_capable=="no"
ATTRSmanufacturer=="FTDI"
[...]








share|improve this question










share|improve this question




share|improve this question









asked Jun 5 at 21:40









Sparkler

2871311




2871311











  • At KERNELS=="1-3", you probably get a symlink to the raw USB device instead of the tty. You need to match on SUBSYSTEM=="usb-serial" (or whatever subsystem actually produces the tty). This question is a duplicate, and has been asked before in several variants, but I don't have the time to find the old question(s) right now.
    – dirkt
    Jun 6 at 11:50










  • @dirkt I am aware of that. But matching with subsystem is not enough because all the serial ports have the same, "1-3". I was suspecting that the colon is the source of trouble: why does it work for "1-3" but not for "1-3:1.3"?
    – Sparkler
    Jun 6 at 12:37

















  • At KERNELS=="1-3", you probably get a symlink to the raw USB device instead of the tty. You need to match on SUBSYSTEM=="usb-serial" (or whatever subsystem actually produces the tty). This question is a duplicate, and has been asked before in several variants, but I don't have the time to find the old question(s) right now.
    – dirkt
    Jun 6 at 11:50










  • @dirkt I am aware of that. But matching with subsystem is not enough because all the serial ports have the same, "1-3". I was suspecting that the colon is the source of trouble: why does it work for "1-3" but not for "1-3:1.3"?
    – Sparkler
    Jun 6 at 12:37
















At KERNELS=="1-3", you probably get a symlink to the raw USB device instead of the tty. You need to match on SUBSYSTEM=="usb-serial" (or whatever subsystem actually produces the tty). This question is a duplicate, and has been asked before in several variants, but I don't have the time to find the old question(s) right now.
– dirkt
Jun 6 at 11:50




At KERNELS=="1-3", you probably get a symlink to the raw USB device instead of the tty. You need to match on SUBSYSTEM=="usb-serial" (or whatever subsystem actually produces the tty). This question is a duplicate, and has been asked before in several variants, but I don't have the time to find the old question(s) right now.
– dirkt
Jun 6 at 11:50












@dirkt I am aware of that. But matching with subsystem is not enough because all the serial ports have the same, "1-3". I was suspecting that the colon is the source of trouble: why does it work for "1-3" but not for "1-3:1.3"?
– Sparkler
Jun 6 at 12:37





@dirkt I am aware of that. But matching with subsystem is not enough because all the serial ports have the same, "1-3". I was suspecting that the colon is the source of trouble: why does it work for "1-3" but not for "1-3:1.3"?
– Sparkler
Jun 6 at 12:37
















active

oldest

votes











Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f448085%2fudev-rule-with-kernels-argument-does-not-work%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes










 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f448085%2fudev-rule-with-kernels-argument-does-not-work%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Displaying single band from multi-band raster using QGIS

How many registers does an x86_64 CPU actually have?