All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Arkadiusz Miśkiewicz" <a.miskiewicz@gmail.com>
To: Jiri Kosina <jkosina@suse.cz>
Cc: linux-input@vger.kernel.org,
	Nestor Lopez Casado <nlopezcasad@logitech.com>
Subject: Re: logitech-djdevice and /sys
Date: Sat, 31 Mar 2012 07:50:43 +0200	[thread overview]
Message-ID: <201203310750.43619.a.miskiewicz@gmail.com> (raw)
In-Reply-To: <alpine.LNX.2.00.1203301520030.25526@pobox.suse.cz>

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

      reply	other threads:[~2012-03-31  5:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201203310750.43619.a.miskiewicz@gmail.com \
    --to=a.miskiewicz@gmail.com \
    --cc=jkosina@suse.cz \
    --cc=linux-input@vger.kernel.org \
    --cc=nlopezcasad@logitech.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.