.web – Entry to the port ‘/dev/bus/usb/001/001’ is denied exception on Raspberry Pi 4 when utilizing System.IO.Ports.SerialPort.Open

I'm creating an software utilizing .NET 6.0 on a Raspberry Pi 4 working Raspbian Lite. When I attempt to Open a USB port, I get the message:

Entry to the port '/dev/bus/usb/001/001' is denied.

I've tried the next:

  1. Added the next line to native.guidelines:

    SUBSYSTEM=="usb", ATTRS{idVendor}=="VVVV", ATTR{idProduct}=="PPPP", MODE="0660", GROUP="plugdev"

    The place:

    VVVV is the Vendor Id and PPPP is the Product Id obtained from lsusb.

  2. Added the consumer to dialout group with the command:

    sudo adduser your_username dialout

  3. Edited the config.txt in /boot and enabled I2C, SPI, and UART.

  4. Rebooted the Raspberry Pi 4.

  5. Verified that the consumer was a member of the teams with:

    teams consumer

The consumer is a member of the dialout and different teams.

When executed, the C# .NET 6 code beneath throws an exception when on the USB.Open(); name:

        strive
            {
                Console.WriteLine("Making an attempt port {0}...", port);

                var USB = new SerialPort(port, 9600, Parity.None, 8, StopBits.One);
                USB.ReadTimeout = 1000;

                Console.WriteLine("Opening port: {0}", port);

                USB.Open();

The exception is:

`Entry to the port '/dev/bus/usb/001/001' is denied.`
  1. Wanting on the udevadm data:

    udevadm data -q path -n /dev/bus/usb/001/003

    udevadm data -ap /units/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.1

    taking a look at gadget '/units/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.1':

     KERNEL=="1-1.1"
     SUBSYSTEM=="usb"
     DRIVER=="usb"
     ATTR{licensed}=="1"
     ATTR{avoid_reset_quirk}=="0"
     ATTR{bConfigurationValue}=="1"
     ATTR{bDeviceClass}=="00"
     ATTR{bDeviceProtocol}=="00"
     ATTR{bDeviceSubClass}=="00"
     ATTR{bMaxPacketSize0}=="8"
     ATTR{bMaxPower}=="100mA"
     ATTR{bNumConfigurations}=="1"
     ATTR{bNumInterfaces}==" 3"
     ATTR{bcdDevice}=="0100"
     ATTR{bmAttributes}=="80"
     ATTR{bcdDevice}=="0100"
     ATTR{bmAttributes}=="80"
     ATTR{busnum}=="1"
     ATTR{configuration}==""
     ATTR{devnum}=="3"
     ATTR{devpath}=="1.1"
     ATTR{devspec}=="(null)"
     ATTR{idProduct}=="0808"
     ATTR{idVendor}=="8086"
     ATTR{ltm_capable}=="no"
     ATTR{producer}=="C-Media Electronics Inc.      "
     ATTR{maxchild}=="0"
     ATTR{energy/active_duration}=="4681910"
     ATTR{energy/autosuspend}=="2"
     ATTR{energy/autosuspend_delay_ms}=="2000"
     ATTR{energy/connected_duration}=="4681910"
     ATTR{energy/management}=="on"
     ATTR{energy/degree}=="on"
    ATTR{energy/persist}=="1"
     ATTR{energy/runtime_active_time}=="4681672"
     ATTR{energy/runtime_status}=="energetic"
     ATTR{energy/runtime_suspended_time}=="0"
     ATTR{product}=="USB PnP Sound System"
     ATTR{quirks}=="0x0"
     ATTR{detachable}=="unknown"
     ATTR{rx_lanes}=="1"
     ATTR{velocity}=="12"
     ATTR{tx_lanes}=="1"
     ATTR{urbnum}=="44"
     ATTR{model}==" 1.10"
    

That is most likely a configuration subject on the Raspberry Pi 4. The exception stack-trace again to System.IO.Ports.SerialPort.Open().

My questions are:

  • Am I overlooking one thing that's easy?

  • Do I want to present particular permissions to the dotnet command in order that I can run the .NET software with administrative privledges?

  • Is that this a identified subject with .NET 6.0 on Raspbian and Linux?

  • Is there a third-party or open-source class for USB ports which may be used with .NET 6.0 on Raspbian and Linux?

  • We examined the identical Raspberry Pi 4 and USB microphone utilizing the arecord command. This labored with none Entry points. We at the moment are taking a look at Python and C++ approaches.



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *