0

I am getting an "Access Denied" on a USB port '/dev/bus/usb/001/004' on a Raspberry Pi 3B/4/4B that is running Raspbian Lite.

  • When I issue the command:

    ls -l /dev/bus/001/004

    I see the following:

    crw-rw-r-- 1 root root 189, 3 Jan 6 13:45 /dev/bus/usb/001/004

  • The current user is a member of the following groups:

    pi adm dialout cdrom sudo audio video plugdev games users input netdev spi i2c gpio

  • While the current user is a member of the dialout group that is often cited as a requirement to access USB ports, the USB port itself is only a member of the root group.

  • When I look at the UDEV rules in /lib/udev/rules.d, there is a rules file named 40-usb_modeswitch.rules. This file, however, is empty.

My questions are:

  1. Am I on the right track in thinking that I need to enable the USB ports by adding entries to the 40-usb_modeswitch.rules?
  2. Do I need to add rules to the 60-serial.rules file?
  3. Will this add the USB ports to the dialin group?
  4. Are there references on how to enable USB ports on a Raspberry Pi 3B/4/4B?
5
  • "how to enable USB ports" Enable in what sense? There's nothing here that implies the USB ports are disabled or need enabling. All you are talking about is permissions on a /dev node, and one that is pretty abstract in practice: When you plug in a USB device such as a keyboard or hard drive, this usually creates a new dev node with separate permissions and ownership -- but none of this stuff requires a user have permission on, eg., /dev/input/mouse0 in order to make normal use of the mouse. Make sure you don't have an XY problem.
    – goldilocks
    Jan 6, 2022 at 16:00
  • Eg., If this is about accessing a USB UART serial adapter, you are going about it the wrong way.
    – goldilocks
    Jan 6, 2022 at 16:05
  • I am not sure if this is USB UART. We were seeing a "Access denied" on a port whenever we tried to programmatically open a USB port on a Pi 4 running Raspbian Lite. It looks like there are no rules in the out-of-the-box Raspbian Lite related to USB ports. I am not a Linux expert, but from on-line documentation, (as far as I could tell), the absence of rules that place the USB device in a group other than root and the absence of a permanent name are problems that prevent USB ports from being opened programmatically. The open function will not accept "/dev/bus/001/004" as a port name. Jan 7, 2022 at 11:02
  • A USB UART serial adapter is something you plug into a USB port and the other end is 4+ wires for attaching to UART pins. Saying briefly that the context is to access the port in code clarifies that it isn't an XY problem; I was just concerned that someone was off on a wild goose chase trying to make a serial adapter (or some other USB device) work.
    – goldilocks
    Jan 7, 2022 at 15:53
  • Thanks very much for explaining the USB UART. XY problems are certainly expensive and something to avoid when possible. Any comments that keep our project on track are most welcome. Jan 7, 2022 at 17:59

1 Answer 1

2

1&2 :In general, it is better to keep your own rules separate from the system rules. I would create a file /etc/udev/rules.d/50-localusb.rules with the content:

SUBSYSTEMS=="usb", ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", GROUP="dialin", MODE="0666"

You may get idVendor and idProduct from an lsusb.

3: Depends on the rule that you place there, ofcourse.

4: There are many Linux references; you should be able to find them with google udev usb devices permissions or something like that.

2
  • I have not yet been able to get this to work. It appears that the new rules are not being loaded at all. I have tried placing this in /etc/udev/rules and /usr/lib/udev/rules.d. I am working through documentation to see what needs to be done to have rules take effect. Jan 7, 2022 at 19:05
  • Changed "dialin" to "dialout". This worked. Jan 7, 2022 at 20:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.