* logitech-djdevice and /sys
@ 2012-03-22 17:44 Arkadiusz Miśkiewicz
2012-03-30 13:25 ` Jiri Kosina
0 siblings, 1 reply; 3+ messages in thread
From: Arkadiusz Miśkiewicz @ 2012-03-22 17:44 UTC (permalink / raw)
To: linux-input; +Cc: Nestor Lopez Casado, Jiri Kosina
Hi,
I'm detecting usb keyboards from shell using this simple script:
for i in /sys/class/input/input*; do
[ ! -f $i/device/bInterfaceClass -o ! -f $i/device/bInterfaceProtocol ] && continue
bInterfaceClass=$(cat $i/device/bInterfaceClass)
bInterfaceProtocol=$(cat $i/device/bInterfaceProtocol)
if [ "$bInterfaceClass" = "03" -a "$bInterfaceProtocol" = "01" ]; then
module=$(readlink $i/device/driver/module)
module=$(basename $module)
echo "found keyboard driven by $module"
fi
done
but for keyboards hidden behind logitech unifying receiver
there seem to be no such information in /sys.
Any ideas on how I can detect such keyboards via /sys or other
scriptable method?
(note that I'm interested only in "regular" keyboards, so single buttons
and some other devices are not interesting)
dmesg:
[130816.672862] usb 6-2: new full-speed USB device number 4 using uhci_hcd
[130816.856173] usb 6-2: New USB device found, idVendor=046d, idProduct=c52b
[130816.856183] usb 6-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[130816.856190] usb 6-2: Product: USB Receiver
[130816.856195] usb 6-2: Manufacturer: Logitech
[130816.868751] logitech-djreceiver 0003:046D:C52B.000F: hiddev0,hidraw2: USB HID v1.11 Device [Logitech USB Receiver] on usb-0000:00:1d.0-2/input2
[130816.878201] input: Logitech Unifying Device. Wireless PID:4004 as /devices/pci0000:00/0000:00:1d.0/usb6/6-2/6-2:1.2/0003:046D:C52B.000F/input/input14
[130816.878717] logitech-djdevice 0003:046D:C52B.0010: input,hidraw3: USB HID v1.11 Keyboard [Logitech Unifying Device. Wireless PID:4004] on usb-0000:00:1d.0-2:1
--
Arkadiusz Miśkiewicz PLD/Linux Team
arekm / maven.pl http://ftp.pld-linux.org/
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: logitech-djdevice and /sys
2012-03-22 17:44 logitech-djdevice and /sys Arkadiusz Miśkiewicz
@ 2012-03-30 13:25 ` Jiri Kosina
2012-03-31 5:50 ` Arkadiusz Miśkiewicz
0 siblings, 1 reply; 3+ messages in thread
From: Jiri Kosina @ 2012-03-30 13:25 UTC (permalink / raw)
To: Arkadiusz Miśkiewicz; +Cc: linux-input, Nestor Lopez Casado
On Thu, 22 Mar 2012, Arkadiusz Miśkiewicz wrote:
> Hi,
>
> I'm detecting usb keyboards from shell using this simple script:
>
> for i in /sys/class/input/input*; do
> [ ! -f $i/device/bInterfaceClass -o ! -f $i/device/bInterfaceProtocol ] && continue
> bInterfaceClass=$(cat $i/device/bInterfaceClass)
> bInterfaceProtocol=$(cat $i/device/bInterfaceProtocol)
> if [ "$bInterfaceClass" = "03" -a "$bInterfaceProtocol" = "01" ]; then
> module=$(readlink $i/device/driver/module)
> module=$(basename $module)
>
> echo "found keyboard driven by $module"
> fi
> done
>
> but for keyboards hidden behind logitech unifying receiver there seem to
> be no such information in /sys.
>
> Any ideas on how I can detect such keyboards via /sys or other
> scriptable method?
>
> (note that I'm interested only in "regular" keyboards, so single buttons
> and some other devices are not interesting)
>
> dmesg:
>
> [130816.672862] usb 6-2: new full-speed USB device number 4 using uhci_hcd
> [130816.856173] usb 6-2: New USB device found, idVendor=046d, idProduct=c52b
> [130816.856183] usb 6-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
> [130816.856190] usb 6-2: Product: USB Receiver
> [130816.856195] usb 6-2: Manufacturer: Logitech
> [130816.868751] logitech-djreceiver 0003:046D:C52B.000F: hiddev0,hidraw2: USB HID v1.11 Device [Logitech USB Receiver] on usb-0000:00:1d.0-2/input2
> [130816.878201] input: Logitech Unifying Device. Wireless PID:4004 as /devices/pci0000:00/0000:00:1d.0/usb6/6-2/6-2:1.2/0003:046D:C52B.000F/input/input14
> [130816.878717] logitech-djdevice 0003:046D:C52B.0010: input,hidraw3: USB HID v1.11 Keyboard [Logitech Unifying Device. Wireless PID:4004] on usb-0000:00:1d.0-2:1
I suggest you inspect all available input devices using EVIOCGBIT ioctl()
instead, querying the device capabilities (and looking namely on the
EV_KEY capabilities).
Alternatively, you can find this information prepared for you in
/proc/bus/input/devices.
If you really want to restrict yourself to USB keyboards, you'll have to
inspect 'Phys' as well. This you can do via EVIOCGPHYS ioctl() or look
into procfs as well.
--
Jiri Kosina
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: logitech-djdevice and /sys
2012-03-30 13:25 ` Jiri Kosina
@ 2012-03-31 5:50 ` Arkadiusz Miśkiewicz
0 siblings, 0 replies; 3+ messages in thread
From: Arkadiusz Miśkiewicz @ 2012-03-31 5:50 UTC (permalink / raw)
To: Jiri Kosina; +Cc: linux-input, Nestor Lopez Casado
On Friday 30 of March 2012, Jiri Kosina wrote:
> On Thu, 22 Mar 2012, Arkadiusz Miśkiewicz wrote:
> > Hi,
> >
> > I'm detecting usb keyboards from shell using this simple script:
> >
> > for i in /sys/class/input/input*; do
> >
> > [ ! -f $i/device/bInterfaceClass -o ! -f
> > $i/device/bInterfaceProtocol ] && continue
> > bInterfaceClass=$(cat $i/device/bInterfaceClass)
> > bInterfaceProtocol=$(cat $i/device/bInterfaceProtocol)
> > if [ "$bInterfaceClass" = "03" -a "$bInterfaceProtocol"
> > = "01" ]; then
> >
> > module=$(readlink $i/device/driver/module)
> >
> > module=$(basename $module)
> >
> > echo "found keyboard driven by $module"
> >
> > fi
> >
> > done
> >
> > but for keyboards hidden behind logitech unifying receiver there seem to
> > be no such information in /sys.
> >
> > Any ideas on how I can detect such keyboards via /sys or other
> > scriptable method?
> >
> > (note that I'm interested only in "regular" keyboards, so single buttons
> > and some other devices are not interesting)
> >
> > dmesg:
> >
> > [130816.672862] usb 6-2: new full-speed USB device number 4 using
> > uhci_hcd [130816.856173] usb 6-2: New USB device found, idVendor=046d,
> > idProduct=c52b [130816.856183] usb 6-2: New USB device strings: Mfr=1,
> > Product=2, SerialNumber=0 [130816.856190] usb 6-2: Product: USB Receiver
> > [130816.856195] usb 6-2: Manufacturer: Logitech
> > [130816.868751] logitech-djreceiver 0003:046D:C52B.000F: hiddev0,hidraw2:
> > USB HID v1.11 Device [Logitech USB Receiver] on
> > usb-0000:00:1d.0-2/input2 [130816.878201] input: Logitech Unifying
> > Device. Wireless PID:4004 as
> > /devices/pci0000:00/0000:00:1d.0/usb6/6-2/6-2:1.2/0003:046D:C52B.000F/in
> > put/input14 [130816.878717] logitech-djdevice 0003:046D:C52B.0010:
> > input,hidraw3: USB HID v1.11 Keyboard [Logitech Unifying Device.
> > Wireless PID:4004] on usb-0000:00:1d.0-2:1
>
> I suggest you inspect all available input devices using EVIOCGBIT ioctl()
> instead, querying the device capabilities (and looking namely on the
> EV_KEY capabilities).
>
> Alternatively, you can find this information prepared for you in
> /proc/bus/input/devices.
>
> If you really want to restrict yourself to USB keyboards, you'll have to
> inspect 'Phys' as well. This you can do via EVIOCGPHYS ioctl() or look
> into procfs as well.
Ok, thanks. Seems there is no good way to find out regular keyboards only
since many non keyboard devices have some keys.
--
Arkadiusz Miśkiewicz PLD/Linux Team
arekm / maven.pl http://ftp.pld-linux.org/
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-03-31 5:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-22 17:44 logitech-djdevice and /sys Arkadiusz Miśkiewicz
2012-03-30 13:25 ` Jiri Kosina
2012-03-31 5:50 ` Arkadiusz Miśkiewicz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).