-
Notifications
You must be signed in to change notification settings - Fork 129
How to format data from the file usb.ids to the file 51 android.rules
yanghui edited this page May 25, 2014
·
2 revisions
1.Download the file usb.ids from http://www.linux-usb.org/usb.ids
wget -c http://www.linux-usb.org/usb.ids
2.Delete the other section from the file usb.ids but "Vendors, devices and interfaces".
0001 Fry's Electronics
142b Arbiter Systems, Inc.
7778 Counterfeit flash drive [Kingston]
0002 Ingram
0003 Club Mac
0004 Nebraska Furniture Mart
...
eb2a KWorld
f003 Hewlett Packard
6002 PhotoSmart C500
f4ec Atten Electronics / Siglent Technologies
ee38 Digital Storage Oscilloscope
3.use sed to delete other unuseful section.
sed -i '/^#/d' usb.ids
sed -i '/^ /d' usb.ids
The second param like space is: a. press CTRL+V b. press TAB
4.format data to the file 51 android.rules
gawk 'BEGIN{FS=" ";OFS="\t"}{print "#"$2" \012SUBSYSTEM==\"usb\", ATTRS{idVendor}==\""$1"\", MODE=\"0660\", GROUP=\"plugdev\"\012"}' usb.ids > 51-android.rules
5.add the header
######################################################
# Project: https://github.com/snowdream/51-android #
# File: /etc/udev/rules.d/51-android.rules #
# Author: snowdream <[email protected]> #
# Date: 2014.05.25 #
######################################################
That's All.