2

I have home made device that can be connected via USB port. When connected it gets ttyACM socket. So I have asked this question some time ago about how to set read/write permissions for device. Following the answer I have created /etc/udev/rules.d/50-ttyusb.rules file with this content:

KERNEL=="ttyUSB[0-9]*",MODE="0666"
KERNEL=="ttyACM[0-9]*",MODE="0666"

All works fine! But if I understand correctly, now every device connected on any ttyUSB or ttyACM socket will have read/write permissions. Right?

My question is how can I automatically set read/write permissions only for this device when connected?

Relevant lsusb output:

Bus 003 Device 005: ID ffff:0005
  • 2
    I used rules for my usb cameras because I needed them to always show up in the same location and sometimes they wouldn't .. i used the following KERNEL=="video[0-9]*", SUBSYSTEM=="video4linux", ATTR{name}=="Logitech QuickCam Notebook Pro", SYMLINK+="video-cam1", MODE="0777" ... you don't seem to have a name but maybe you could use something like KERNEL=="ttyUSB[0-9]*",ATTR{ID}==ffff:0005,MODE="0666" though you may need the subsystem... This is only a guess from me because I don't fully understand this and has been a long time since I have played with it. – John Orion Jun 06 '16 at 11:05

1 Answers1

1
  • Yes, it gives permission to public users for all those serial devices.
  • You can use ATTRS{idVendor} & ATTRS{idProduct} to filter out target devices:

    ACTION=="add", KERNEL=="ttyACM[0-9]*", ATTRS{idVendor}=="ffff", ATTRS{idProduct}=="0005", MODE="0666"
    

    I add ACTION=="add" to skip other unwanted event remove (device node removed already) & change (device node already added and configured)

user.dz
  • 48,105