All of lore.kernel.org
 help / color / mirror / Atom feed
* MX5000 support in hid-logitech
@ 2009-09-15 10:40 Corentin Chary
  2009-09-15 11:03 ` Bastien Nocera
  0 siblings, 1 reply; 6+ messages in thread
From: Corentin Chary @ 2009-09-15 10:40 UTC (permalink / raw)
  To: Jiri Kosina; +Cc: linux-input

Hi,
I'm trying to add support for MX5000 keyboard in hid-lg.c, and it's the first 
time I'm playing with hid drivers.

I added the keys in lg_wireless_mapping()

        case 0x01b8: lg_map_key_clear(KEY_VIDEO);               break;
        case 0x01b7: lg_map_key_clear(KEY_AUDIO);               break;
        case 0x01bc: lg_map_key_clear(KEY_MESSENGER);           break;
        case 0x0183: lg_map_key_clear(KEY_MEDIA);               break;
        case 0x0230: lg_map_key_clear(KEY_ZOOMRESET);           break;
        case 0x022e: lg_map_key_clear(KEY_ZOOMOUT);             break;
        case 0x022d: lg_map_key_clear(KEY_ZOOMIN);              break;
        case 0x0184: lg_map_key_clear(KEY_WORDPROCESSOR);       break;
        case 0x0186: lg_map_key_clear(KEY_SPREADSHEET);         break;
        case 0x0188: lg_map_key_clear(KEY_PRESENTATION);        break;

And that line in static const struct hid_device_id lg_devices[]

        { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xc70a),
                .driver_data = LG_RDESC | LG_WIRELESS },

I also added a printk lg_event() to find usage->hid and check
if the device was correctly probed.

I use xev to detect keystrocks.

But Adding the code in lg_wireless_mapping() didn't change anything, keys are 
not reported in xev.

I added a printk between case 0x01b8: and lg_map_key_clear(KEY_VIDEO); to 
check if the branch was taken, and it is.

Did I do something wrong ?
Any suggestion ?

(Please CC me, I didn't subscribed to linux-input)

Thanks,
-- 
Corentin Chary
http://xf.iksaif.net

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: MX5000 support in hid-logitech
  2009-09-15 10:40 MX5000 support in hid-logitech Corentin Chary
@ 2009-09-15 11:03 ` Bastien Nocera
  2009-09-15 12:44   ` Corentin Chary
  0 siblings, 1 reply; 6+ messages in thread
From: Bastien Nocera @ 2009-09-15 11:03 UTC (permalink / raw)
  To: Corentin Chary; +Cc: Jiri Kosina, linux-input

On Tue, 2009-09-15 at 12:40 +0200, Corentin Chary wrote:
> Hi,
> I'm trying to add support for MX5000 keyboard in hid-lg.c, and it's the first 
> time I'm playing with hid drivers.
> 
> I added the keys in lg_wireless_mapping()
> 
>         case 0x01b8: lg_map_key_clear(KEY_VIDEO);               break;
>         case 0x01b7: lg_map_key_clear(KEY_AUDIO);               break;
>         case 0x01bc: lg_map_key_clear(KEY_MESSENGER);           break;
>         case 0x0183: lg_map_key_clear(KEY_MEDIA);               break;
>         case 0x0230: lg_map_key_clear(KEY_ZOOMRESET);           break;
>         case 0x022e: lg_map_key_clear(KEY_ZOOMOUT);             break;
>         case 0x022d: lg_map_key_clear(KEY_ZOOMIN);              break;
>         case 0x0184: lg_map_key_clear(KEY_WORDPROCESSOR);       break;
>         case 0x0186: lg_map_key_clear(KEY_SPREADSHEET);         break;
>         case 0x0188: lg_map_key_clear(KEY_PRESENTATION);        break;
> 
> And that line in static const struct hid_device_id lg_devices[]
> 
>         { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xc70a),
>                 .driver_data = LG_RDESC | LG_WIRELESS },
> 
> I also added a printk lg_event() to find usage->hid and check
> if the device was correctly probed.
> 
> I use xev to detect keystrocks.
> 
> But Adding the code in lg_wireless_mapping() didn't change anything, keys are 
> not reported in xev.
> 
> I added a printk between case 0x01b8: and lg_map_key_clear(KEY_VIDEO); to 
> check if the branch was taken, and it is.
> 
> Did I do something wrong ?
> Any suggestion ?

This won't be enough, check the archives for more details (around 10th
February this year)

You'll need to poke at the receiver using the same kind of code that
mx5000lib does. Your best bet is probably to start with Jiri's
recommendations and get debugging info from the kernel before going any
further.

Cheers


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: MX5000 support in hid-logitech
  2009-09-15 11:03 ` Bastien Nocera
@ 2009-09-15 12:44   ` Corentin Chary
  2009-09-15 13:52     ` Corentin Chary
  0 siblings, 1 reply; 6+ messages in thread
From: Corentin Chary @ 2009-09-15 12:44 UTC (permalink / raw)
  To: Bastien Nocera; +Cc: Jiri Kosina, linux-input

On Tuesday 15 September 2009 13:03:53 Bastien Nocera wrote:
> On Tue, 2009-09-15 at 12:40 +0200, Corentin Chary wrote:
> > Hi,
> > I'm trying to add support for MX5000 keyboard in hid-lg.c, and it's the
> > first time I'm playing with hid drivers.
> >
> > I added the keys in lg_wireless_mapping()
> >
> >         case 0x01b8: lg_map_key_clear(KEY_VIDEO);               break;
> >         case 0x01b7: lg_map_key_clear(KEY_AUDIO);               break;
> >         case 0x01bc: lg_map_key_clear(KEY_MESSENGER);           break;
> >         case 0x0183: lg_map_key_clear(KEY_MEDIA);               break;
> >         case 0x0230: lg_map_key_clear(KEY_ZOOMRESET);           break;
> >         case 0x022e: lg_map_key_clear(KEY_ZOOMOUT);             break;
> >         case 0x022d: lg_map_key_clear(KEY_ZOOMIN);              break;
> >         case 0x0184: lg_map_key_clear(KEY_WORDPROCESSOR);       break;
> >         case 0x0186: lg_map_key_clear(KEY_SPREADSHEET);         break;
> >         case 0x0188: lg_map_key_clear(KEY_PRESENTATION);        break;
> >
> > And that line in static const struct hid_device_id lg_devices[]
> >
> >         { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xc70a),
> >                 .driver_data = LG_RDESC | LG_WIRELESS },
> >
> > I also added a printk lg_event() to find usage->hid and check
> > if the device was correctly probed.
> >
> > I use xev to detect keystrocks.
> >
> > But Adding the code in lg_wireless_mapping() didn't change anything, keys
> > are not reported in xev.
> >
> > I added a printk between case 0x01b8: and lg_map_key_clear(KEY_VIDEO); to
> > check if the branch was taken, and it is.
> >
> > Did I do something wrong ?
> > Any suggestion ?
> 
> This won't be enough, check the archives for more details (around 10th
> February this year)
> 
> You'll need to poke at the receiver using the same kind of code that
> mx5000lib does. Your best bet is probably to start with Jiri's
> recommendations and get debugging info from the kernel before going any
> further.

It seems to work without poking the receiver.
As I said, these keys can be seen in lg_event().

So, I tried that code in lg_event() (with the previous code in 
lg_wireless_mapping()):

 unsigned int key = 0;
 struct input_dev *input = field->hidinput->input;

 switch (usage->hid & HID_USAGE) {
  case 0x01b8: key = KEY_VIDEO;           break;
  case 0x01b7: key = KEY_AUDIO;           break;
  case 0x01bc: key = KEY_MESSENGER;       break;
  case 0x0183: key = KEY_MEDIA;           break;
  case 0x0230: key = KEY_ZOOMRESET;       break;
  case 0x022e: key = KEY_ZOOMOUT;         break;
  case 0x022d: key = KEY_ZOOMIN;          break;
  case 0x0184: key = KEY_WORDPROCESSOR;   break;
  case 0x0186: key = KEY_SPREADSHEET;     break;
  case 0x0188: key = KEY_PRESENTATION;    break;
  default: return 0;
 }
 printk(KERN_WARNING "%x %x %x\n", usage->hid, usage->type, value);
 if (key) {
  input_event(input, usage->type, key, value);
  return 1;
 }

And it worked (with showkey in a terminal, not with xev, maybe I need to 
restart X for that ?).

But adding that code in lg_event() doesn't look right :/
-- 
Corentin Chary
http://xf.iksaif.net

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: MX5000 support in hid-logitech
  2009-09-15 12:44   ` Corentin Chary
@ 2009-09-15 13:52     ` Corentin Chary
  2009-09-15 14:34       ` Jiri Kosina
  0 siblings, 1 reply; 6+ messages in thread
From: Corentin Chary @ 2009-09-15 13:52 UTC (permalink / raw)
  To: Bastien Nocera; +Cc: Jiri Kosina, linux-input

On Tuesday 15 September 2009 14:44:28 Corentin Chary wrote:
> On Tuesday 15 September 2009 13:03:53 Bastien Nocera wrote:
> > On Tue, 2009-09-15 at 12:40 +0200, Corentin Chary wrote:
> > > Hi,
> > > I'm trying to add support for MX5000 keyboard in hid-lg.c, and it's the
> > > first time I'm playing with hid drivers.
> > >
> > > I added the keys in lg_wireless_mapping()
> > >
> > >         case 0x01b8: lg_map_key_clear(KEY_VIDEO);               break;
> > >         case 0x01b7: lg_map_key_clear(KEY_AUDIO);               break;
> > >         case 0x01bc: lg_map_key_clear(KEY_MESSENGER);           break;
> > >         case 0x0183: lg_map_key_clear(KEY_MEDIA);               break;
> > >         case 0x0230: lg_map_key_clear(KEY_ZOOMRESET);           break;
> > >         case 0x022e: lg_map_key_clear(KEY_ZOOMOUT);             break;
> > >         case 0x022d: lg_map_key_clear(KEY_ZOOMIN);              break;
> > >         case 0x0184: lg_map_key_clear(KEY_WORDPROCESSOR);       break;
> > >         case 0x0186: lg_map_key_clear(KEY_SPREADSHEET);         break;
> > >         case 0x0188: lg_map_key_clear(KEY_PRESENTATION);        break;
> > >
> > > And that line in static const struct hid_device_id lg_devices[]
> > >
> > >         { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xc70a),
> > >                 .driver_data = LG_RDESC | LG_WIRELESS },
> > >
> > > I also added a printk lg_event() to find usage->hid and check
> > > if the device was correctly probed.
> > >
> > > I use xev to detect keystrocks.
> > >
> > > But Adding the code in lg_wireless_mapping() didn't change anything,
> > > keys are not reported in xev.
> > >
> > > I added a printk between case 0x01b8: and lg_map_key_clear(KEY_VIDEO);
> > > to check if the branch was taken, and it is.
> > >
> > > Did I do something wrong ?
> > > Any suggestion ?
> >
> > This won't be enough, check the archives for more details (around 10th
> > February this year)
> >
> > You'll need to poke at the receiver using the same kind of code that
> > mx5000lib does. Your best bet is probably to start with Jiri's
> > recommendations and get debugging info from the kernel before going any
> > further.
> 
> It seems to work without poking the receiver.
> As I said, these keys can be seen in lg_event().
> 
> So, I tried that code in lg_event() (with the previous code in
> lg_wireless_mapping()):
> 
>  unsigned int key = 0;
>  struct input_dev *input = field->hidinput->input;
> 
>  switch (usage->hid & HID_USAGE) {
>   case 0x01b8: key = KEY_VIDEO;           break;
>   case 0x01b7: key = KEY_AUDIO;           break;
>   case 0x01bc: key = KEY_MESSENGER;       break;
>   case 0x0183: key = KEY_MEDIA;           break;
>   case 0x0230: key = KEY_ZOOMRESET;       break;
>   case 0x022e: key = KEY_ZOOMOUT;         break;
>   case 0x022d: key = KEY_ZOOMIN;          break;
>   case 0x0184: key = KEY_WORDPROCESSOR;   break;
>   case 0x0186: key = KEY_SPREADSHEET;     break;
>   case 0x0188: key = KEY_PRESENTATION;    break;
>   default: return 0;
>  }
>  printk(KERN_WARNING "%x %x %x\n", usage->hid, usage->type, value);
>  if (key) {
>   input_event(input, usage->type, key, value);
>   return 1;
>  }
> 
> And it worked (with showkey in a terminal, not with xev, maybe I need to
> restart X for that ?).
> 
> But adding that code in lg_event() doesn't look right :/
> 

In fact .. my first patch works with showkey, not with xev ...
I'll try to figure out why.

-- 
Corentin Chary
http://xf.iksaif.net

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: MX5000 support in hid-logitech
  2009-09-15 13:52     ` Corentin Chary
@ 2009-09-15 14:34       ` Jiri Kosina
  2009-09-15 16:04         ` Corentin Chary
  0 siblings, 1 reply; 6+ messages in thread
From: Jiri Kosina @ 2009-09-15 14:34 UTC (permalink / raw)
  To: Corentin Chary; +Cc: Bastien Nocera, linux-input

On Tue, 15 Sep 2009, Corentin Chary wrote:

> In fact .. my first patch works with showkey, not with xev ...
> I'll try to figure out why.

That's unfortunate limitation of X server/protocol -- keycodes higher than 
255 (more than 8 bit) do not reach the usual desktop applications (e.g. 
xev). See http://bugs.freedesktop.org/show_bug.cgi?id=11227 for more 
information.

-- 
Jiri Kosina
SUSE Labs, Novell Inc.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: MX5000 support in hid-logitech
  2009-09-15 14:34       ` Jiri Kosina
@ 2009-09-15 16:04         ` Corentin Chary
  0 siblings, 0 replies; 6+ messages in thread
From: Corentin Chary @ 2009-09-15 16:04 UTC (permalink / raw)
  To: Jiri Kosina; +Cc: Bastien Nocera, linux-input

On Tue, Sep 15, 2009 at 4:34 PM, Jiri Kosina <jkosina@suse.cz> wrote:
> On Tue, 15 Sep 2009, Corentin Chary wrote:
>
>> In fact .. my first patch works with showkey, not with xev ...
>> I'll try to figure out why.
>
> That's unfortunate limitation of X server/protocol -- keycodes higher than
> 255 (more than 8 bit) do not reach the usual desktop applications (e.g.
> xev). See http://bugs.freedesktop.org/show_bug.cgi?id=11227 for more
> information.

Thanks. I'll post a patch working with showkey then ...

-- 
Corentin Chary
http://xf.iksaif.net

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-09-15 16:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-15 10:40 MX5000 support in hid-logitech Corentin Chary
2009-09-15 11:03 ` Bastien Nocera
2009-09-15 12:44   ` Corentin Chary
2009-09-15 13:52     ` Corentin Chary
2009-09-15 14:34       ` Jiri Kosina
2009-09-15 16:04         ` Corentin Chary

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.