Skip to content

Instantly share code, notes, and snippets.

@Starefossen
Created March 4, 2013 19:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Starefossen/5084860 to your computer and use it in GitHub Desktop.
Save Starefossen/5084860 to your computer and use it in GitHub Desktop.
The 'RUN' directive is necessary to set /dev/bus/usb/PORT/ADDRESS permissions along with /dev/usb_endpointPORT.ADDRESS_epNN The script is as follows http://www.segger2.com/index.php?page=Thread&threadID=103
BUS!="usb", ACTION!="add", SUBSYSTEM!=="usb_endpoint", GOTO="kcontrol_rules_end"
SUBSYSTEM=="usb_endpoint", ATTRS{idProduct}=="0101", ATTRS{idVendor}=="1366", MODE="0666", GROUP="usbusergroup", RUN+="/usr/local/bin/chk_jlink"
LABEL="kcontrol_rules_end"
#!/bin/bash
GROUP="usbusergroup"
# Get the bus directory
BUS_DIR=`echo $DEVNAME | sed -e "s|/dev/usbdev\([0-9]*\).\([0-9]*\)_.*|\1 \2|" | awk '{printf "%03d/%03d",$1,$2}'`
FULL_PATH=/dev/bus/usb/$BUS_DIR
# Set permissions for FULL_PATH
chgrp -f --preserve-root $GROUP $FULL_PATH
chmod 0664 $FULL_PATH
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment