daniel-santos / mcp2210-linux

MCP2210 driver for linux
http://danielthesantos.blogspot.com/search/label/mcp2210
51 stars 31 forks source link

udev rule #10

Open mweal-ed opened 10 years ago

mweal-ed commented 10 years ago

Per your note in the readme file. I use the following for a udev rule and it seems to work for me on ubuntu 14.04 x86_64

# NOTE: This udev file will grant read and write access to ALL users,
# include non-privileged users, for ALL USB devices that have a matching
# Vendor/Product ID according to the rules below. If this is not desirable 
# and you would like to put more restrictions on access to these devices, then 
# read http://reactivated.net/writing_udev_rules.html for more information.

SUBSYSTEM=="usb", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="00de", MODE="0666", GROUP="plugdev", RUN="/bin/sh -c 'echo -n $id:1.0 > $sys/bus/usb/drivers/usbhid/unbind; echo -n $id:1.0 > $sys/bus/usb/drivers/mcp2210/bind'"
SUBSYSTEM=="usb_device", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="00de", MODE="0666", GROUP="plugdev", RUN="/bin/sh -c 'echo -n $id:1.0 > $sys/bus/usb/drivers/usbhid/unbind; echo -n $id:1.0 > $sys/bus/usb/drivers/mcp2210/bind'"
# Once done, optionally rename this file for your device, and drop it into
# /etc/udev/rules.d and unplug and re-plug your device. This is all that is
# necessary to see the new permissions. Udev does not have to be restarted.

# If you think permissions of 0666 are too loose, then see:
# http://reactivated.net/writing_udev_rules.html for more information on finer
# grained permission setting. For example, it might be sufficient to just
# set the group or user owner for specific devices (for example the plugdev
# group on some systems).

Edited 6-21-14 by Daniel Santos: formatting

mweal-ed commented 10 years ago

Sorry about making you fix the formatting. I am new to github and am still learning some of the features.

daniel-santos commented 10 years ago

Thank you very much! Don't worry about the formatting :)

Sorry, the smart ass in me couldn't help it. And honestly, it's a pain, especially when editing the README.md. I this website to help me with that since I don't like the idea of committing and pushing just to find out if it formats correctly!

ToBeReplaced commented 8 years ago

I'm using the following on CentOS 7.2, because I like having deterministic spidev numbers, and because I needed to use $kernel instead of $id from above. It sets the bus to 2210 and the chipselect to the symbol number. Ex: GP5 is exposed at /dev/spidev2210.5.

SUBSYSTEM=="usb", ATTR{idVendor}=="04d8", ATTR{idProduct}=="00de", RUN="/usr/bin/sh -c '/usr/bin/echo -n $kernel:1.0 > $sys/bus/usb/drivers/usbhid/unbind; /usr/bin/echo -n $kernel:1.0 > $sys/bus/usb/drivers/mcp2210/bind'"
SUBSYSTEM=="spidev", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="00de", PROGRAM="/usr/bin/sh -c '/usr/bin/echo %k | /usr/bin/cut -f 2 -d .'" SYMLINK="spidev2210.%c"
daniel-santos commented 8 years ago

Oh cool! Thanks!