udev - program to query all device attributes to build a rule
PATCH 1/1 udev - program to query all device attributes to build a rule
Hi,
here is a small program to query all attributes of a device and print these in the udev key format. It may help to get the keys to define a rule.
thanks,
Kay
USB Flash Reader:
kay@pim:~/src/udev.kay/extras/udevinfo$ ./udevinfo /sys/block/sda/sda3
device '/sys/block/sda/sda3' has major:minor 8:3 looking at class device '/sys/block/sda/sda3':
SYSFS_dev="8:3"
SYSFS_start="384"
SYSFS_size="192"
SYSFS_stat=" 0 0 0 0"
follow class device's "device" link '/sys/block/sda':
BUS="scsi"
ID="56:0:0:0"
SYSFS_dev="8:0"
SYSFS_range="16"
SYSFS_size="31360"
SYSFS_stat=" 12 0 96 88 0 0 0 0 0 88 88"Or the USB Webcam:
kay@pim:~/src/udev.kay/extras/udevinfo$ ./udevinfo /sys/class/video4linux/video0/
device '/sys/class/video4linux/video0' has major:minor 81:0 looking at class device '/sys/class/video4linux/video0':
SYSFS_dev="81:0"
SYSFS_name="OV511 USB Camera"
SYSFS_custom_id="21"
SYSFS_model="Creative Labs WebCam 3"
SYSFS_bridge="OV511+"
SYSFS_sensor="OV7620"
SYSFS_brightness="105"
SYSFS_saturation="192"
SYSFS_contrast="86"
SYSFS_hue="128"
SYSFS_exposure="0"
follow class device's "device" link '/sys/class/video4linux/video0':
BUS="usb"
ID="1-1.2"
SYSFS_dev="81:0"
SYSFS_name="OV511 USB Camera"
SYSFS_custom_id="21"
SYSFS_model="Creative Labs WebCam 3"
SYSFS_bridge="OV511+"
SYSFS_sensor="OV7620"
SYSFS_brightness="105"
SYSFS_saturation="192"
SYSFS_contrast="86"
SYSFS_hue="128"
SYSFS_exposure="0"extras/udevinfo/Makefile new file +14 -0
@@ -0,0 +1,14 @@ +PROG=udevinfo +LD=$(CC) +OBJS=udevinfo.o + +all: $(PROG) + +clean: + rm -f $(PROG) $(OBJS) + +$(PROG): $(OBJS) + $(LD) $(LDFLAGS) -o $(PROG) $(CRT0) $(OBJS) $(SYSFS) + +me: + cd ../..; make EXTRAS=extras/udevinfo
extras/udevinfo/udevinfo.c new file +133 -0
133 lines not on this page · raw message
Quoted 4 lines · Kay Sievers
Hi,
here is a small program to query all attributes of a device and print these in the udev key format. It may help to get the keys to define a rule.
Fixed a typo - the sysfs_device is right now.
USB FLash Reader:
kay@pim:~/src/udev.kay$ extras/udevinfo/udevinfo /sys/block/sda/sda1
device '/sys/block/sda/sda1' has major:minor 8:1
looking at class device '/sys/block/sda/sda1':
SYSFS_dev="8:1"
SYSFS_start="32"
SYSFS_size="160"
SYSFS_stat=" 0 0 0 0"
follow class device's "device" link '/sys/block/sda':
BUS="scsi"
ID="57:0:0:0"
SYSFS_detach_state="0"
SYSFS_type="0"
SYSFS_device_blocked="0"
SYSFS_queue_depth="1"
SYSFS_scsi_level="3"
SYSFS_vendor="SMSC "
SYSFS_model="USB 2 HS-CF"
SYSFS_rev="1.25"
SYSFS_online="1"extras/udevinfo/Makefile new file +14 -0
@@ -0,0 +1,14 @@ +PROG=udevinfo +LD=$(CC) +OBJS=udevinfo.o + +all: $(PROG) + +clean: + rm -f $(PROG) $(OBJS) + +$(PROG): $(OBJS) + $(LD) $(LDFLAGS) -o $(PROG) $(CRT0) $(OBJS) $(SYSFS) + +me: + cd ../..; make EXTRAS=extras/udevinfo
extras/udevinfo/udevinfo.c new file +132 -0
132 lines not on this page · raw message
Quoted 7 lines · Kay Sievers
Quoted 4 lines · Kay Sievers
Hi,
here is a small program to query all attributes of a device and print these in the udev key format. It may help to get the keys to define a rule.Fixed a typo - the
sysfs_deviceis right now.
Nice program. Applied, thanks.
greg k-h
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 4 lines · Kay Sievers
Hi,
here is a small program to query all attributes of a device and print these in the udev key format. It may help to get the keys to define a rule.
I get link errors without this patch.
make 'EXTRAS=extras/scsi_id extras/udevinfo' USE_LOGúlse USE_KLIBC=true STRIP=/bin/true
Maybe I should build it against glibc.
extras/udevinfo/Makefile +2 -1
@@ -1,5 +1,6 @@ PROG=udevinfo LD=$(CC) +override SYSFS= -L../../libsysfs -lsysfs OBJS=udevinfo.o all: $(PROG)
@@ -8,7 +9,7 @@ clean: rm -f $(PROG) $(OBJS) $(PROG): $(OBJS) - $(LD) $(LDFLAGS) -o $(PROG) $(CRT0) $(OBJS) $(SYSFS) + $(LD) $(LDFLAGS) -o $(PROG) $(CRT0) $(OBJS) $(SYSFS) $(LIB_OBJS) $(ARCH_LIB_OBJS) me: cd ../..; make EXTRAS=extras/udevinfo
Signature · 14 lines
USB is for mice, FireWire is for men! sUse lINUX ag, nÜRNBERG ------------------------------------------------------- The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. http://www.eclipsecon.org/osdn _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net [email protected] https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel