Page 1 of 1

SOLVED: How can I write a script to do the following ...

Posted: Wed Dec 06, 2017 11:29 am
by Pepi
I have a USB device that will create a hidraw file in /dev when it is attached. after you unplug the device the file is deleted :cry: How can I write a script that I can run after plugging in the device. The hidraw file needs the permissions changed for some reason? I've been doing the below on the command program but I would like to be able to just run a script to do this.
Thanks


cd ../..

cd dev

sudo chmod 777 hidraw*

Re: How can I write a script to do the following ...

Posted: Wed Dec 06, 2017 11:46 am
by rene
You shouldn't write a script as such but a udev rule. Which, mind you, only come across as intimidating. Usually and in this case someone else has already done the work and you only need to place a single-line file somewhere under /etc/udev/rules.d. See first (self-)answer at https://unix.stackexchange.com/question ... ermissions

Re: How can I write a script to do the following ...

Posted: Wed Dec 06, 2017 12:17 pm
by Pepi
Thank you kind sir :D Worked like a charm.

I added KERNEL=="hidraw*", SUBSYSTEM=="hidraw", MODE="0664", GROUP="plugdev" to a file and that's IT :mrgreen: