mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Support for Snapstream Firefly remote added to ati_remote.c
@ 2004-09-21 18:35 dylan
  2004-09-21 19:07 ` Vojtech Pavlik
  0 siblings, 1 reply; 5+ messages in thread
From: dylan @ 2004-09-21 18:35 UTC (permalink / raw)
  To: greg; +Cc: linux-kernel

I've added support for the Snapstream Firefly X10 remote
(http://www.snapstream.com/Products/firefly/). This involved adding a new
product ID, and adding some additional logic to the event_lookup function.
The Firefly alternately encodes the keypress data differently than the
driver currently expects, so that every other keypress is invalid with the
current driver version. The transformation is pretty simple; I'm assuming
it's there simply to allow the driver to distinguish between what two
distinct key events looks like and what it looks like to drop signal in
the middle of holding a remote button.

As well, I also added a module_param called disable_keyboard which allows
the user to toggle off whether the driver actually sends key events, or
simply generates raw evdev events. I found this useful, since I'm working
on an app that reads the evdev events natively and then sends it's own
keyboard/mouse/window events in X. The keyboard events being sent by the
driver were interfering with the events I wanted to generate myself.

This patch applies to version 2.6.9-rc1-mm4.

Signed-off-by: Dylan Paris <kernelcontrib@ultimation.org>

--- ati_remote.c.orig   2004-09-21 11:03:26.214097225 -0700
+++ ati_remote.c        2004-09-13 22:55:28.000000000 -0700
@@ -22,6 +22,9 @@
  *                Vincent Vanackere <vanackere@lif.univ-mrs.fr>
  *            Added support for the "Lola" remote contributed by:
  *                Seth Cohn <sethcohn@yahoo.com>
+ *  August 2004: Dylan Paris <kernelcontrib@ultimation.org>
+ *               Version 2.2.2
+ *              Added support for the Snapstream Firefly remote
  *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  *
@@ -102,6 +105,7 @@
 #define ATI_REMOTE_VENDOR_ID   0x0bc7
 #define ATI_REMOTE_PRODUCT_ID  0x004
 #define LOLA_REMOTE_PRODUCT_ID         0x002
+#define FIREFLY_REMOTE_PRODUCT_ID  0x0008

 #define DRIVER_VERSION                 "2.2.1"
 #define DRIVER_AUTHOR           "Torrey Hoffman <thoffman@arnor.net>"
@@ -116,9 +120,13 @@ module_param(channel_mask, ulong, 0444);
 MODULE_PARM_DESC(channel_mask, "Bitmask of remote control channels to
ignore");

 static int debug = 0;
-module_param(debug, int, 0444);
+module_param(debug, int, 0666);
 MODULE_PARM_DESC(debug, "Enable extra debug messages and information");

+static int disable_keyboard = 0;
+module_param(disable_keyboard, int, 0666);
+MODULE_PARM_DESC(disable_keyboard, "Disable sending keyboard events");
+
 #define dbginfo(dev, format, arg...) do { if (debug) dev_info(dev ,
format , ## arg); } while (0)
 #undef err
 #define err(format, arg...) printk(KERN_ERR format , ## arg)
@@ -126,6 +134,7 @@ MODULE_PARM_DESC(debug, "Enable extra de
 static struct usb_device_id ati_remote_table[] = {
        { USB_DEVICE(ATI_REMOTE_VENDOR_ID, ATI_REMOTE_PRODUCT_ID) },
        { USB_DEVICE(ATI_REMOTE_VENDOR_ID, LOLA_REMOTE_PRODUCT_ID) },
+       { USB_DEVICE(ATI_REMOTE_VENDOR_ID, FIREFLY_REMOTE_PRODUCT_ID) },
        {}      /* Terminating entry */
 };

@@ -280,6 +289,9 @@ static struct
        {KIND_FILTERED, 0xf4, 0x2F, EV_KEY, KEY_END, 1},        /* END */
        {KIND_FILTERED, 0xf5, 0x30, EV_KEY, KEY_SELECT, 1},     /* SELECT */

+       /* Firefly Remote Buttons */
+       {KIND_FILTERED, 0xf1, 0x2c, EV_KEY, KEY_KATAKANA, 1},     /*
MAXIMIZE */
+
        {KIND_END, 0x00, 0x00, EV_MAX + 1, 0, 0}
 };

@@ -444,8 +456,15 @@ static int ati_remote_event_lookup(int r
                    ((((ati_remote_tbl[i].data1 >> 4) -
                       (d1 >> 4) + rem) & 0x0f) == 0x0f) &&
                    (ati_remote_tbl[i].data2 == d2))
-                       return i;
-
+                 return i;
+
+
+               if ((((ati_remote_tbl[i].data1 & 0x0f) == (d1 & 0x0f))) &&
+                   ((d1 >> 4) == (((ati_remote_tbl[i].data1 >> 4) + 1 ) &
0x0f )) &&
+                   (((ati_remote_tbl[i].data2 & 0x0f) == (d2 & 0x0f))) &&
+                   ((d2 >> 4) == ((ati_remote_tbl[i].data2 >> 4) ^ 0x8)))
+                 return i;
+
        }
        return -1;
 }
@@ -460,6 +479,7 @@ static void ati_remote_input_report(stru
        struct input_dev *dev = &ati_remote->idev;
        int index, acc;
        int remote_num;
+       int ev_type;

        /* Deal with strange looking inputs */
        if ( (urb->actual_length != 4) || (data[0] != 0x14) ||
@@ -492,7 +512,9 @@ static void ati_remote_input_report(stru

        if (ati_remote_tbl[index].kind == KIND_LITERAL) {
                input_regs(dev, regs);
-               input_event(dev, ati_remote_tbl[index].type,
+
+               ev_type = ((disable_keyboard) ? 0 :
ati_remote_tbl[index].type);
+               input_event(dev, ev_type,
                        ati_remote_tbl[index].code,
                        ati_remote_tbl[index].value);
                input_sync(dev);
@@ -520,11 +542,12 @@ static void ati_remote_input_report(stru
                    && (ati_remote->repeat_count < 5))
                        return;

+               ev_type = ((disable_keyboard) ? 0 :
ati_remote_tbl[index].type);

                input_regs(dev, regs);
-               input_event(dev, ati_remote_tbl[index].type,
+               input_event(dev, ev_type,
                        ati_remote_tbl[index].code, 1);
-               input_event(dev, ati_remote_tbl[index].type,
+               input_event(dev, ev_type,
                        ati_remote_tbl[index].code, 0);
                input_sync(dev);

@@ -729,7 +752,8 @@ static int ati_remote_probe(struct usb_i
        /* See if the offered device matches what we can accept */
        if ((udev->descriptor.idVendor != ATI_REMOTE_VENDOR_ID) ||
                ( (udev->descriptor.idProduct != ATI_REMOTE_PRODUCT_ID) &&
-                 (udev->descriptor.idProduct != LOLA_REMOTE_PRODUCT_ID) ))
+                 (udev->descriptor.idProduct != LOLA_REMOTE_PRODUCT_ID) &&
+                 (udev->descriptor.idProduct !=
FIREFLY_REMOTE_PRODUCT_ID) ))
                return -ENODEV;

        /* Allocate and clear an ati_remote struct */


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

* Re: [PATCH] Support for Snapstream Firefly remote added to ati_remote.c
  2004-09-21 18:35 [PATCH] Support for Snapstream Firefly remote added to ati_remote.c dylan
@ 2004-09-21 19:07 ` Vojtech Pavlik
  2004-09-21 19:35   ` dylan
  0 siblings, 1 reply; 5+ messages in thread
From: Vojtech Pavlik @ 2004-09-21 19:07 UTC (permalink / raw)
  To: dylan; +Cc: greg, linux-kernel

On Tue, Sep 21, 2004 at 11:35:55AM -0700, dylan@ultimation.org wrote:

> I've added support for the Snapstream Firefly X10 remote
> (http://www.snapstream.com/Products/firefly/). This involved adding a new
> product ID, and adding some additional logic to the event_lookup function.
> The Firefly alternately encodes the keypress data differently than the
> driver currently expects, so that every other keypress is invalid with the
> current driver version. The transformation is pretty simple; I'm assuming
> it's there simply to allow the driver to distinguish between what two
> distinct key events looks like and what it looks like to drop signal in
> the middle of holding a remote button.
> 
> As well, I also added a module_param called disable_keyboard which allows
> the user to toggle off whether the driver actually sends key events, or
> simply generates raw evdev events. I found this useful, since I'm working
> on an app that reads the evdev events natively and then sends it's own
> keyboard/mouse/window events in X. The keyboard events being sent by the
> driver were interfering with the events I wanted to generate myself.
> 
> This patch applies to version 2.6.9-rc1-mm4.
> 
> Signed-off-by: Dylan Paris <kernelcontrib@ultimation.org>
> 
> @@ -280,6 +289,9 @@ static struct
>         {KIND_FILTERED, 0xf4, 0x2F, EV_KEY, KEY_END, 1},        /* END */
>         {KIND_FILTERED, 0xf5, 0x30, EV_KEY, KEY_SELECT, 1},     /* SELECT */
> 
> +       /* Firefly Remote Buttons */
> +       {KIND_FILTERED, 0xf1, 0x2c, EV_KEY, KEY_KATAKANA, 1},     /* MAXIMIZE */
> +

Now, now, would it be too hard to add a proper key definition into
input.h? I don't think you want the remote to change character sets on
Japanese machines.

> @@ -460,6 +479,7 @@ static void ati_remote_input_report(stru
>         struct input_dev *dev = &ati_remote->idev;
>         int index, acc;
>         int remote_num;
> +       int ev_type;
> 
>         /* Deal with strange looking inputs */
>         if ( (urb->actual_length != 4) || (data[0] != 0x14) ||
> @@ -492,7 +512,9 @@ static void ati_remote_input_report(stru
> 
>         if (ati_remote_tbl[index].kind == KIND_LITERAL) {
>                 input_regs(dev, regs);
> -               input_event(dev, ati_remote_tbl[index].type,
> +
> +               ev_type = ((disable_keyboard) ? 0 : > ati_remote_tbl[index].type);
> +               input_event(dev, ev_type,
>                         ati_remote_tbl[index].code,
>                         ati_remote_tbl[index].value);
>                 input_sync(dev);

I won't let you abuse the input API this way. Event type 0 is EV_SYN and
is reserved for synchronization and configuration change notifications.
Definitely not for sending events that look like keystrokes but aren't.

There is a nice ioctl, called EVIOCGRAB which will give you what you
want (the console won't be receiving the events anymore) without any
ugly hacks.

-- 
Vojtech Pavlik
SuSE Labs, SuSE CR

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

* Re: [PATCH] Support for Snapstream Firefly remote added to  ati_remote.c
  2004-09-21 19:07 ` Vojtech Pavlik
@ 2004-09-21 19:35   ` dylan
  2004-09-22  5:07     ` Vojtech Pavlik
  0 siblings, 1 reply; 5+ messages in thread
From: dylan @ 2004-09-21 19:35 UTC (permalink / raw)
  To: Vojtech Pavlik; +Cc: dylan, greg, linux-kernel

> On Tue, Sep 21, 2004 at 11:35:55AM -0700, dylan@ultimation.org wrote:
>
>> I've added support for the Snapstream Firefly X10 remote
>> (http://www.snapstream.com/Products/firefly/). This involved adding a
>> new
>> product ID, and adding some additional logic to the event_lookup
>> function.
>> The Firefly alternately encodes the keypress data differently than the
>> driver currently expects, so that every other keypress is invalid with
>> the
>> current driver version. The transformation is pretty simple; I'm
>> assuming
>> it's there simply to allow the driver to distinguish between what two
>> distinct key events looks like and what it looks like to drop signal in
>> the middle of holding a remote button.
>>
>> As well, I also added a module_param called disable_keyboard which
>> allows
>> the user to toggle off whether the driver actually sends key events, or
>> simply generates raw evdev events. I found this useful, since I'm
>> working
>> on an app that reads the evdev events natively and then sends it's own
>> keyboard/mouse/window events in X. The keyboard events being sent by the
>> driver were interfering with the events I wanted to generate myself.
>>
>> This patch applies to version 2.6.9-rc1-mm4.
>>
>> Signed-off-by: Dylan Paris <kernelcontrib@ultimation.org>
>>
>> @@ -280,6 +289,9 @@ static struct
>>         {KIND_FILTERED, 0xf4, 0x2F, EV_KEY, KEY_END, 1},        /* END
>> */
>>         {KIND_FILTERED, 0xf5, 0x30, EV_KEY, KEY_SELECT, 1},     /*
>> SELECT */
>>
>> +       /* Firefly Remote Buttons */
>> +       {KIND_FILTERED, 0xf1, 0x2c, EV_KEY, KEY_KATAKANA, 1},     /*
>> MAXIMIZE */
>> +
>
> Now, now, would it be too hard to add a proper key definition into
> input.h? I don't think you want the remote to change character sets on
> Japanese machines.
>

Will do.

>> @@ -460,6 +479,7 @@ static void ati_remote_input_report(stru
>>         struct input_dev *dev = &ati_remote->idev;
>>         int index, acc;
>>         int remote_num;
>> +       int ev_type;
>>
>>         /* Deal with strange looking inputs */
>>         if ( (urb->actual_length != 4) || (data[0] != 0x14) ||
>> @@ -492,7 +512,9 @@ static void ati_remote_input_report(stru
>>
>>         if (ati_remote_tbl[index].kind == KIND_LITERAL) {
>>                 input_regs(dev, regs);
>> -               input_event(dev, ati_remote_tbl[index].type,
>> +
>> +               ev_type = ((disable_keyboard) ? 0 : >
>> ati_remote_tbl[index].type);
>> +               input_event(dev, ev_type,
>>                         ati_remote_tbl[index].code,
>>                         ati_remote_tbl[index].value);
>>                 input_sync(dev);
>
> I won't let you abuse the input API this way. Event type 0 is EV_SYN and
> is reserved for synchronization and configuration change notifications.
> Definitely not for sending events that look like keystrokes but aren't.
>
> There is a nice ioctl, called EVIOCGRAB which will give you what you
> want (the console won't be receiving the events anymore) without any
> ugly hacks.
>

Sorry for the hacks, I'm still learning about how this all works. I was
just excited that I was able to get it "work" at all, even if it was
really ugly. ;)  I'll look into EVIOCGRAB and touch up the patch before
thinking about resubmitting again. Thanks for the input!

> --
> Vojtech Pavlik
> SuSE Labs, SuSE CR
>



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

* Re: [PATCH] Support for Snapstream Firefly remote added to ati_remote.c
  2004-09-21 19:35   ` dylan
@ 2004-09-22  5:07     ` Vojtech Pavlik
  0 siblings, 0 replies; 5+ messages in thread
From: Vojtech Pavlik @ 2004-09-22  5:07 UTC (permalink / raw)
  To: dylan; +Cc: greg, linux-kernel

On Tue, Sep 21, 2004 at 12:35:35PM -0700, dylan@ultimation.org wrote:

> >> @@ -460,6 +479,7 @@ static void ati_remote_input_report(stru
> >>         struct input_dev *dev = &ati_remote->idev;
> >>         int index, acc;
> >>         int remote_num;
> >> +       int ev_type;
> >>
> >>         /* Deal with strange looking inputs */
> >>         if ( (urb->actual_length != 4) || (data[0] != 0x14) ||
> >> @@ -492,7 +512,9 @@ static void ati_remote_input_report(stru
> >>
> >>         if (ati_remote_tbl[index].kind == KIND_LITERAL) {
> >>                 input_regs(dev, regs);
> >> -               input_event(dev, ati_remote_tbl[index].type,
> >> +
> >> +               ev_type = ((disable_keyboard) ? 0 : >
> >> ati_remote_tbl[index].type);
> >> +               input_event(dev, ev_type,
> >>                         ati_remote_tbl[index].code,
> >>                         ati_remote_tbl[index].value);
> >>                 input_sync(dev);
> >
> > I won't let you abuse the input API this way. Event type 0 is EV_SYN and
> > is reserved for synchronization and configuration change notifications.
> > Definitely not for sending events that look like keystrokes but aren't.
> >
> > There is a nice ioctl, called EVIOCGRAB which will give you what you
> > want (the console won't be receiving the events anymore) without any
> > ugly hacks.
> >
> 
> Sorry for the hacks, I'm still learning about how this all works. I was
> just excited that I was able to get it "work" at all, even if it was
> really ugly. ;)  I'll look into EVIOCGRAB and touch up the patch before
> thinking about resubmitting again. Thanks for the input!
 
Ok, I'll be looking forward to your patch. :)

-- 
Vojtech Pavlik
SuSE Labs, SuSE CR

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

* [PATCH] Support for Snapstream Firefly remote added to ati_remote.c
@ 2004-09-21 18:16 dylan
  0 siblings, 0 replies; 5+ messages in thread
From: dylan @ 2004-09-21 18:16 UTC (permalink / raw)
  To: greg; +Cc: linux-kernel

I've added support for the Snapstream Firefly X10 remote
(http://www.snapstream.com/Products/firefly/). This involved adding a new
product ID, and adding some additional logic to the event_lookup function.
The Firefly alternately encodes the keypress data differently than the
driver currently expects, so that every other keypress is invalid with the
current driver version. The transformation is pretty simple; I'm assuming
it's there simply to allow the driver to distinguish between what two
distinct key events looks like and what it looks like to drop signal in
the middle of holding a remote button.

As well, I also added a module_param called disable_keyboard which allows
the user to toggle off whether the driver actually sends key events, or
simply generates raw evdev events. I found this useful, since I'm working
on an app that reads the evdev events natively and then sends it's own
keyboard/mouse/window events in X. The keyboard events being sent by the
driver were interfering with the events I wanted to generate myself.

This patch applies to version 2.6.9-rc1-mm4.

Signed-off-by: Dylan Paris <kernelcontrib@ultimation.org>

--- ati_remote.c.orig   2004-09-21 11:03:26.214097225 -0700
+++ ati_remote.c        2004-09-13 22:55:28.000000000 -0700
@@ -22,6 +22,9 @@
  *                Vincent Vanackere <vanackere@lif.univ-mrs.fr>
  *            Added support for the "Lola" remote contributed by:
  *                Seth Cohn <sethcohn@yahoo.com>
+ *  August 2004: Dylan Paris <kernelcontrib@ultimation.org>
+ *               Version 2.2.2
+ *              Added support for the Snapstream Firefly remote
  *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  *
@@ -102,6 +105,7 @@
 #define ATI_REMOTE_VENDOR_ID   0x0bc7
 #define ATI_REMOTE_PRODUCT_ID  0x004
 #define LOLA_REMOTE_PRODUCT_ID         0x002
+#define FIREFLY_REMOTE_PRODUCT_ID  0x0008

 #define DRIVER_VERSION                 "2.2.1"
 #define DRIVER_AUTHOR           "Torrey Hoffman <thoffman@arnor.net>"
@@ -116,9 +120,13 @@ module_param(channel_mask, ulong, 0444);
 MODULE_PARM_DESC(channel_mask, "Bitmask of remote control channels to
ignore");

 static int debug = 0;
-module_param(debug, int, 0444);
+module_param(debug, int, 0666);
 MODULE_PARM_DESC(debug, "Enable extra debug messages and information");

+static int disable_keyboard = 0;
+module_param(disable_keyboard, int, 0666);
+MODULE_PARM_DESC(disable_keyboard, "Disable sending keyboard events");
+
 #define dbginfo(dev, format, arg...) do { if (debug) dev_info(dev ,
format , ## arg); } while (0)
 #undef err
 #define err(format, arg...) printk(KERN_ERR format , ## arg)
@@ -126,6 +134,7 @@ MODULE_PARM_DESC(debug, "Enable extra de
 static struct usb_device_id ati_remote_table[] = {
        { USB_DEVICE(ATI_REMOTE_VENDOR_ID, ATI_REMOTE_PRODUCT_ID) },
        { USB_DEVICE(ATI_REMOTE_VENDOR_ID, LOLA_REMOTE_PRODUCT_ID) },
+       { USB_DEVICE(ATI_REMOTE_VENDOR_ID, FIREFLY_REMOTE_PRODUCT_ID) },
        {}      /* Terminating entry */
 };

@@ -280,6 +289,9 @@ static struct
        {KIND_FILTERED, 0xf4, 0x2F, EV_KEY, KEY_END, 1},        /* END */
        {KIND_FILTERED, 0xf5, 0x30, EV_KEY, KEY_SELECT, 1},     /* SELECT */

+       /* Firefly Remote Buttons */
+       {KIND_FILTERED, 0xf1, 0x2c, EV_KEY, KEY_KATAKANA, 1},     /*
MAXIMIZE */
+
        {KIND_END, 0x00, 0x00, EV_MAX + 1, 0, 0}
 };

@@ -444,8 +456,15 @@ static int ati_remote_event_lookup(int r
                    ((((ati_remote_tbl[i].data1 >> 4) -
                       (d1 >> 4) + rem) & 0x0f) == 0x0f) &&
                    (ati_remote_tbl[i].data2 == d2))
-                       return i;
-
+                 return i;
+
+
+               if ((((ati_remote_tbl[i].data1 & 0x0f) == (d1 & 0x0f))) &&
+                   ((d1 >> 4) == (((ati_remote_tbl[i].data1 >> 4) + 1 ) &
0x0f )) &&
+                   (((ati_remote_tbl[i].data2 & 0x0f) == (d2 & 0x0f))) &&
+                   ((d2 >> 4) == ((ati_remote_tbl[i].data2 >> 4) ^ 0x8)))
+                 return i;
+
        }
        return -1;
 }
@@ -460,6 +479,7 @@ static void ati_remote_input_report(stru
        struct input_dev *dev = &ati_remote->idev;
        int index, acc;
        int remote_num;
+       int ev_type;

        /* Deal with strange looking inputs */
        if ( (urb->actual_length != 4) || (data[0] != 0x14) ||
@@ -492,7 +512,9 @@ static void ati_remote_input_report(stru

        if (ati_remote_tbl[index].kind == KIND_LITERAL) {
                input_regs(dev, regs);
-               input_event(dev, ati_remote_tbl[index].type,
+
+               ev_type = ((disable_keyboard) ? 0 :
ati_remote_tbl[index].type);
+               input_event(dev, ev_type,
                        ati_remote_tbl[index].code,
                        ati_remote_tbl[index].value);
                input_sync(dev);
@@ -520,11 +542,12 @@ static void ati_remote_input_report(stru
                    && (ati_remote->repeat_count < 5))
                        return;

+               ev_type = ((disable_keyboard) ? 0 :
ati_remote_tbl[index].type);

                input_regs(dev, regs);
-               input_event(dev, ati_remote_tbl[index].type,
+               input_event(dev, ev_type,
                        ati_remote_tbl[index].code, 1);
-               input_event(dev, ati_remote_tbl[index].type,
+               input_event(dev, ev_type,
                        ati_remote_tbl[index].code, 0);
                input_sync(dev);

@@ -729,7 +752,8 @@ static int ati_remote_probe(struct usb_i
        /* See if the offered device matches what we can accept */
        if ((udev->descriptor.idVendor != ATI_REMOTE_VENDOR_ID) ||
                ( (udev->descriptor.idProduct != ATI_REMOTE_PRODUCT_ID) &&
-                 (udev->descriptor.idProduct != LOLA_REMOTE_PRODUCT_ID) ))
+                 (udev->descriptor.idProduct != LOLA_REMOTE_PRODUCT_ID) &&
+                 (udev->descriptor.idProduct !=
FIREFLY_REMOTE_PRODUCT_ID) ))
                return -ENODEV;

        /* Allocate and clear an ati_remote struct */


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

end of thread, other threads:[~2004-09-22  5:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-21 18:35 [PATCH] Support for Snapstream Firefly remote added to ati_remote.c dylan
2004-09-21 19:07 ` Vojtech Pavlik
2004-09-21 19:35   ` dylan
2004-09-22  5:07     ` Vojtech Pavlik
  -- strict thread matches above, loose matches on Subject: below --
2004-09-21 18:16 dylan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®