Adam Kropelin wrote:
> 
> We already do deliver all events to hiddev, as of 2.6.12-rc1. I remember 
> specifically because the change broke userspace.
> 
> <http://linux.bkbits.net:8080/linux-2.6/diffs/drivers/usb/input/[EMAIL 
> PROTECTED]|src/.|src/drivers|src/drivers/usb|src/drivers/usb/input|hist/drivers/usb/input/hid-core.c>
> 
> --Adam
> 

I was using Linux  2.6.17.7

See below for a full extract of the 2.6.17.7 code.
Notice where I have commented out lines with +//
and inserted an +#if 0...+#endif to comment out a larger section.
This code (before my changes) is definitely doing filtering on events
destined for the hiddev device. This code acts before it has decided
which device to send the event to. My changes do not seem to adversely
affect the usb mouse usage.

/*
 * Analyse a received field, and fetch the data from it. The field
 * content is stored for next report processing (we do differential
 * reporting to the layer).
 */

static void hid_input_field(struct hid_device *hid, struct hid_field
*field, __u8 *data, int interrupt, struct pt_regs *regs)
{
        unsigned n;
        unsigned count = field->report_count;
        unsigned offset = field->report_offset;
        unsigned size = field->report_size;
        __s32 min = field->logical_minimum;
        __s32 max = field->logical_maximum;
        __s32 *value;

        if (!(value = kmalloc(sizeof(__s32) * count, GFP_ATOMIC)))
                return;

        for (n = 0; n < count; n++) {

                        value[n] = min < 0 ? snto32(extract(data, offset
+ n * size, size), size) :
                                                    extract(data, offset
+ n * size, size);

                        if (!(field->flags & HID_MAIN_ITEM_VARIABLE) /*
Ignore report if ErrorRollOver */
                            && value[n] >= min && value[n] <= max
                            && field->usage[value[n] - min].hid ==
HID_UP_KEYBOARD + 1)
                                goto exit;
        }

        for (n = 0; n < count; n++) {

+//              if (HID_MAIN_ITEM_VARIABLE & field->flags) {
                        hid_process_event(hid, field, &field->usage[n],
value[n], interrupt, regs);
                        continue;
+//              }
+#if 0
                if (field->value[n] >= min && field->value[n] <= max
                        && field->usage[field->value[n] - min].hid
                       && search(value, field->value[n], count))
                                hid_process_event(hid, field,
&field->usage[field->value[n] - min], 0, interrupt, regs);

                if (value[n] >= min && value[n] <= max
                        && field->usage[value[n] - min].hid
                        && search(field->value, value[n], count))
                                hid_process_event(hid, field,
&field->usage[value[n] - min], 1, interrupt, regs);
+#endif
        }

        memcpy(field->value, value, count * sizeof(__s32));
exit:
        kfree(value);
}


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to