Created
February 26, 2019 16:50
-
-
Save evaporei/58a0b9f60763a5222b4bfe763014ddca to your computer and use it in GitHub Desktop.
Script to make USB device work on Linux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| device_info_output="$(lsusb | grep $1)" | |
| device_info_array=($device_info_output) | |
| bus_number="${device_info_array[1]}" | |
| device_number="${device_info_array[3]::-1}" | |
| echo "${bus_number}" | |
| echo "${device_number}" | |
| sudo chmod 777 /dev/bus/usb/"$bus_number"/"$device_number" |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Another way to solve the problem that doesn't require to run this script everytime is to create a file like this:
Name:
/usr/lib/udev/rules.d/50-name_of_your_device.rulesContent:
Where:
name_of_your_devicecan be what ever you want, in my opinion it is better to reference something that references your device (ex:gertec);vendor_id_of_websiteshould be a number that is on this website: http://www.linux-usb.org/usb.ids. To find your USB id just useCtrl + Fand look for your device name.Example, my device is from
Gertec:So the content of my file should be: