Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux: SecurityError: Access denied. #16

Open
wraybowling opened this issue Jul 12, 2020 · 2 comments
Open

Linux: SecurityError: Access denied. #16

wraybowling opened this issue Jul 12, 2020 · 2 comments

Comments

@wraybowling
Copy link

wraybowling commented Jul 12, 2020

Using the programmer on linux, I get Access Denied error. According to a stackoverflow answer for using WebUSB on Linux, permissions must be given so that chrome can access the specific daisy seed connected on a specific USB port. The subthread suggests that the workarounds do not reliably work... So here I'll walk through the steps and paste the output.

Step 1: Identify the device via lsusb

$ lsusb
Bus 002 Device 004: ID 046d:c05a Logitech, Inc. M90/M100 Optical Mouse
Bus 002 Device 003: ID 413c:2003 Dell Computer Corp. Keyboard
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 005: ID 0483:df11 STMicroelectronics STM Device in DFU Mode
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Step 2: Create a new file in /etc/udev/rules.d/

sudo vim /etc/udev/rules.d/99-daisy.rules
# Daisy Seed in DFU Mode

SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTR{idProduct}=="df11", MODE="0660", GROUP="plugdev"

Step 3: Reconnect...
SecurityError: Access denied.

The same error occurs with a boiled down version that attempts to simply connect. So this isn't exclusive to the electrosmith programmer; it's across the board for Linux users and WebUSB.

<!DOCTYPE html>
<html>
<head allow="usb"></head>
    <body>
   <input type="submit" onclick="connect()" value="connect"/>

    <script>
    var device;
    function setup(device) {
        alert(device.productName+" open");
        return device.open()

        .then(() => device.selectConfiguration(1))
        .then(() => device.claimInterface(0))
    }

    function connect() {
        if (device == null) {
            //navigator.usb.requestDevice({ filters: [{ vendorId : 0483 }] })
	    navigator.usb.requestDevice({filters: []})
            .then(selectedDevice => {
                device = selectedDevice;
                console.log(device);
                return setup(device);
            })

            .catch(error => { console.log(error); })
        }


    }
    navigator.usb.getDevices()
    .then(devices => {
        if (devices.length > 0) {
            device = devices[0];
            return setup(device);
        }
    })
    .catch(error => { console.log(error); });
    </script>
    </body>
</html>

Javascript Console

USBDevice {
configurations: Array(1),
deviceClass: 0,
deviceProtocol: 0,
deviceSubclass: 0,
deviceVersionMajor: 2,
…
}
configuration: USBConfiguration {
configurationName: null,
configurationValue: 1,
interfaces: Array(1)
}
configurations: [USBConfiguration]
deviceClass: 0
deviceProtocol: 0
deviceSubclass: 0
deviceVersionMajor: 2
deviceVersionMinor: 0
deviceVersionSubminor: 0
manufacturerName: "STMicroelectronics"
opened: false
productId: 57105
productName: "DFU in FS Mode"
serialNumber: "200364500000"
usbVersionMajor: 2
usbVersionMinor: 0
usbVersionSubminor: 0
vendorId: 1155
__proto__: USBDevice

DOMException: Access denied.
@wraybowling
Copy link
Author

This is a problem that happens with Teensy boards as well. Here's their udev file https://www.pjrc.com/teensy/49-teensy.rules

@ri0t
Copy link

ri0t commented Sep 9, 2021

So... yeah that helped program... but i think, it lead to another problem - #31
Shouldn't be relevant here, though?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants