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

Update udev rules and manual to remove non-portable (Debian-specific) use of the plugdev group and 0660 mode #442

Merged
merged 3 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions config/99-cypress.rules → config/70-cypress.rules
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
SUBSYSTEM=="usb", ATTRS{idVendor}=="04b4", ATTRS{idProduct}=="8613", \
MODE="0660", GROUP="plugdev", TAG+="uaccess"
SUBSYSTEM=="usb", ATTRS{idVendor}=="04b4", ATTRS{idProduct}=="8613", TAG+="uaccess"
3 changes: 1 addition & 2 deletions config/99-glasgow.rules → config/70-glasgow.rules
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
SUBSYSTEM=="usb", ATTRS{idVendor}=="20b7", ATTRS{idProduct}=="9db1", \
MODE="0660", GROUP="plugdev", TAG+="uaccess"
SUBSYSTEM=="usb", ATTRS{idVendor}=="20b7", ATTRS{idProduct}=="9db1", TAG+="uaccess"
8 changes: 5 additions & 3 deletions docs/manual/src/build.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,15 @@ Any board that is being factory flashed must have a blank ``FX2_MEM`` EEPROM. If

.. tab:: Linux

Configure your system to allow unprivileged access (for anyone in the ``plugdev`` group) to any hardware that enumerates as the Cypress FX2 ROM bootloader:
Configure your system to allow unprivileged access for anyone logged in to the physical terminal to any hardware that enumerates as the Cypress FX2 ROM bootloader:

.. code:: console

$ sudo cp config/99-cypress.rules /etc/udev/rules.d
$ sudo cp config/70-cypress.rules /etc/udev/rules.d
$ sudo udevadm control --reload
$ sudo udevadm trigger -v -c add -s usb -a idVendor=04b4 -a idProduct=8613

Note that this rule will allow unprivileged access to any device based on the Cypress FX2 that has a blank EEPROM, and not just the Glasgow.
Note that this rule will allow unprivileged access to any device based on the Cypress FX2 that has a blank EEPROM, and not just the Glasgow hardware specifically.

Plug in the newly assembled device. At this point, ``lsusb -d 04b4:8613`` should list one entry. Note the revision of the board you are factory flashing. If the board has revision ``C3``, run:

Expand Down
6 changes: 4 additions & 2 deletions docs/manual/src/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,13 @@ If these instructions don't work for you, please `file a bug <file-a-bug_>`__ so

$ git clone https://github.com/GlasgowEmbedded/glasgow

Configure your system to allow unprivileged access (for anyone in the ``plugdev`` group) to the Glasgow hardware:
Configure your system to allow access to the Glasgow hardware for anyone logged in to the physical terminal, and apply the rules to any devices that are already plugged in:

.. code:: console

$ sudo cp glasgow/config/99-glasgow.rules /etc/udev/rules.d
$ sudo cp glasgow/config/70-glasgow.rules /etc/udev/rules.d
$ sudo udevadm control --reload
$ sudo udevadm trigger -v -c add -s usb -a idVendor=20b7 -a idProduct=9db1

Install the Glasgow software for the current user:

Expand Down
7 changes: 6 additions & 1 deletion software/glasgow/device/hardware.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,12 @@ def hotplug_callback(usb_context, device, event):
else:
continue

handle = device.open()
try:
handle = device.open()
except usb1.USBErrorAccess:
logger.error("missing permissions to open device %03d/%03d",
device.getBusNumber(), device.getDeviceAddress())
continue
if api_level == 0:
logger.debug("found rev%s device without firmware", revision)
elif api_level != CUR_API_LEVEL:
Expand Down