]> git.hungrycats.org Git - linux/commitdiff
By popular request, and explicit method of telling which events
authorVojtech Pavlik <vojtech@twilight.ucw.cz>
Thu, 25 Jul 2002 15:56:28 +0000 (17:56 +0200)
committerVojtech Pavlik <vojtech@twilight.ucw.cz>
Thu, 25 Jul 2002 15:56:28 +0000 (17:56 +0200)
from a device belong together was implemented - input_sync() and
EV_SYN. Touches every input driver. The first to make use of it
is mousedev.c to properly merge events into PS/2 packets.

55 files changed:
Documentation/input/input-programming.txt
drivers/input/input.c
drivers/input/joystick/a3d.c
drivers/input/joystick/adi.c
drivers/input/joystick/amijoy.c
drivers/input/joystick/analog.c
drivers/input/joystick/cobra.c
drivers/input/joystick/db9.c
drivers/input/joystick/gamecon.c
drivers/input/joystick/gf2k.c
drivers/input/joystick/grip.c
drivers/input/joystick/grip_mp.c
drivers/input/joystick/guillemot.c
drivers/input/joystick/iforce/iforce-packets.c
drivers/input/joystick/interact.c
drivers/input/joystick/magellan.c
drivers/input/joystick/sidewinder.c
drivers/input/joystick/spaceball.c
drivers/input/joystick/spaceorb.c
drivers/input/joystick/stinger.c
drivers/input/joystick/tmdc.c
drivers/input/joystick/turbografx.c
drivers/input/joystick/twidjoy.c
drivers/input/joystick/warrior.c
drivers/input/keybdev.c
drivers/input/keyboard/amikbd.c
drivers/input/keyboard/atkbd.c
drivers/input/keyboard/maple_keyb.c
drivers/input/keyboard/newtonkbd.c
drivers/input/keyboard/ps2serkbd.c
drivers/input/keyboard/sunkbd.c
drivers/input/keyboard/xtkbd.c
drivers/input/mouse/amimouse.c
drivers/input/mouse/inport.c
drivers/input/mouse/logibm.c
drivers/input/mouse/maplemouse.c
drivers/input/mouse/pc110pad.c
drivers/input/mouse/psmouse.c
drivers/input/mouse/rpcmouse.c
drivers/input/mouse/sermouse.c
drivers/input/mousedev.c
drivers/input/touchscreen/gunze.c
drivers/input/touchscreen/h3600_ts_input.c
drivers/macintosh/adbhid.c
drivers/macintosh/mac_hid.c
drivers/usb/input/aiptek.c
drivers/usb/input/hid-core.c
drivers/usb/input/hid-input.c
drivers/usb/input/hid.h
drivers/usb/input/powermate.c
drivers/usb/input/usbkbd.c
drivers/usb/input/usbmouse.c
drivers/usb/input/wacom.c
drivers/usb/input/xpad.c
include/linux/input.h

index e5ca6c2cecb52e247c00d88a9b8b8298d4a01836..e96152567ea2a2f4a8afca86fea3ac11ef373df5 100644 (file)
@@ -23,6 +23,7 @@ pressed or released a BUTTON_IRQ happens. The driver could look like:
 static void button_interrupt(int irq, void *dummy, struct pt_regs *fp)
 {
        input_report_key(&button_dev, BTN_1, inb(BUTTON_PORT) & 1);
+       input_sync(&button_dev);
 }
 
 static int __init button_init(void)
@@ -86,13 +87,22 @@ While in use, the only used function of the driver is
 which upon every interrupt from the button checks its state and reports it
 via the 
 
-       input_report_btn()
+       input_report_key()
 
 call to the input system. There is no need to check whether the interrupt
 routine isn't reporting two same value events (press, press for example) to
 the input system, because the input_report_* functions check that
 themselves.
 
+Then there is the
+
+       input_sync()
+
+call to tell those who receive the events that we've sent a complete report.
+This doesn't seem important in the one button case, but is quite important
+for for example mouse movement, where you don't want the X and Y values
+to be interpreted separately, because that'd result in a different movement.
+
 1.2 dev->open() and dev->close()
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
index 054dee43a95c0f4190cb4f158d2e366439347ff7..6f3d59aafe0496bb8bcd934e1a84dafd11e45568 100644 (file)
@@ -72,16 +72,9 @@ void input_event(struct input_dev *dev, unsigned int type, unsigned int code, in
 {
        struct input_handle *handle = dev->handle;
 
-/*
- * Wake up the device if it is sleeping.
- */
        if (dev->pm_dev)
                pm_access(dev->pm_dev);
 
-/*
- * Filter non-events, and bad input values out.
- */
-
        if (type > EV_MAX || !test_bit(type, dev->evbit))
                return;
 
@@ -89,6 +82,19 @@ void input_event(struct input_dev *dev, unsigned int type, unsigned int code, in
 
        switch (type) {
 
+               case EV_SYN:
+                       switch (code) {
+                               case SYN_CONFIG:
+                                       if (dev->event) dev->event(dev, type, code, value);
+                                       break;
+
+                               case SYN_REPORT:
+                                       if (dev->sync) return;
+                                       dev->sync = 1;
+                                       break;
+                       }
+                       break;
+
                case EV_KEY:
 
                        if (code > KEY_MAX || !test_bit(code, dev->keybit) || !!test_bit(code, dev->key) == value)
@@ -185,9 +191,8 @@ void input_event(struct input_dev *dev, unsigned int type, unsigned int code, in
                        break;
        }
 
-/*
- * Distribute the event to handler modules.
- */
+       if (type != EV_SYN) 
+               dev->sync = 0;
 
        while (handle) {
                if (handle->open)
@@ -200,6 +205,7 @@ static void input_repeat_key(unsigned long data)
 {
        struct input_dev *dev = (void *) data;
        input_event(dev, EV_KEY, dev->repeat_key, 2);
+       input_sync(dev);
        mod_timer(&dev->timer, jiffies + dev->rep[REP_PERIOD]);
 }
 
@@ -438,6 +444,12 @@ void input_register_device(struct input_dev *dev)
        struct input_handle *handle;
        struct input_device_id *id;
 
+/*
+ * Add the EV_SYN capability.
+ */
+
+       set_bit(EV_SYN, dev->evbit);
+
 /*
  * Initialize repeat timer to default values.
  */
index d4ab90dd836488734f967a6ceb66f8cf90eb8173..39da8a43b032d6d9c7bad172abb8fc50090a6250 100644 (file)
@@ -130,6 +130,8 @@ static void a3d_read(struct a3d *a3d, unsigned char *data)
                        input_report_key(dev, BTN_LEFT,   data[3] & 2);
                        input_report_key(dev, BTN_MIDDLE, data[3] & 4);
 
+                       input_sync(dev);
+
                        a3d->axes[0] = ((signed char)((data[11] << 6) | (data[12] << 3) | (data[13]))) + 128;
                        a3d->axes[1] = ((signed char)((data[14] << 6) | (data[15] << 3) | (data[16]))) + 128;
                        a3d->axes[2] = ((signed char)((data[17] << 6) | (data[18] << 3) | (data[19]))) + 128;
@@ -165,6 +167,8 @@ static void a3d_read(struct a3d *a3d, unsigned char *data)
                        input_report_key(dev, BTN_TOP,     data[8] & 4);
                        input_report_key(dev, BTN_PINKIE,  data[7] & 1);
 
+                       input_sync(dev);
+
                        return;
        }
 }
index 0f5da7f738e98e7e791895403b1690ea56483701..323bd5e9003df31f54ab59a29117a4e4a6c14e86 100644 (file)
@@ -249,6 +249,8 @@ static int adi_decode(struct adi *adi)
 
        for (i = 63; i < adi->buttons; i++)
                input_report_key(dev, *key++, adi_get_bits(adi, 1));
+       
+       input_sync(dev);
 
        return 0;
 }
index 40ae670e8a5ef3953a4b64d596f57ce97f9514e7..9cdb6ced994110c423277bcd94eaa2b890ddcc8c 100644 (file)
@@ -67,6 +67,8 @@ static void amijoy_interrupt(int irq, void *dummy, struct pt_regs *fp)
                        input_report_abs(amijoy_dev + i, ABS_X, ((data >> 1) & 1) - ((data >> 9) & 1));
                        data = ~(data ^ (data << 1));
                        input_report_abs(amijoy_dev + i, ABS_Y, ((data >> 1) & 1) - ((data >> 9) & 1));
+
+                       input_sync(amijoy_dev + i);
                }
 }
 
index 0e4f7bd841c419f166120c54fedd95c5099a25bc..c5b93777fd148df02e7d1499ca90b84964bbf71b 100644 (file)
@@ -215,6 +215,8 @@ static void analog_decode(struct analog *analog, int *axes, int *initial, int bu
                        input_report_abs(dev, analog_hats[j++],
                                ((buttons >> ((i << 2) + 8)) & 1) - ((buttons >> ((i << 2) + 6)) & 1));
                }
+
+       input_sync(dev);
 }
 
 /*
index fca2dfb2126cab772eebbc5dbfd0b6a05cd14de5..9ca36edd1651792e7454adb0a668f5cbb4f95351 100644 (file)
@@ -136,6 +136,8 @@ static void cobra_timer(unsigned long private)
                        for (j = 0; cobra_btn[j]; j++)
                                input_report_key(dev, cobra_btn[j], data[i] & (0x20 << j));
 
+                       input_sync(dev);
+
                }
 
        mod_timer(&cobra->timer, jiffies + COBRA_REFRESH_TIME); 
index bc8ac5240df272b89c1de9c46771f0a5c8654427..091fe2e887fa070e0a972efde10cc28ab7f85601 100644 (file)
@@ -266,6 +266,8 @@ static void db9_timer(unsigned long private)
                        break;
                }
 
+       input_sync(dev);
+
        mod_timer(&db9->timer, jiffies + DB9_REFRESH_TIME);
 }
 
index 039bb0c8ce9daa661cecec30cd1c78d5c081af17..f8245f98d76ee8b62e99e20cb020cdc297f3574e 100644 (file)
@@ -328,6 +328,8 @@ static void gc_timer(unsigned long private)
 
                                for (j = 0; j < 10; j++)
                                        input_report_key(dev + i, gc_n64_btn[j], s & data[gc_n64_bytes[j]]);
+
+                               input_sync(dev + i);
                        }
                }
        }
@@ -356,6 +358,8 @@ static void gc_timer(unsigned long private)
                        if (s & gc->pads[GC_SNES])
                                for (j = 0; j < 8; j++)
                                        input_report_key(dev + i, gc_snes_btn[j], s & data[gc_snes_bytes[j]]);
+
+                       input_sync(dev + i);
                }
        }
 
@@ -379,6 +383,8 @@ static void gc_timer(unsigned long private)
 
                        if (s & gc->pads[GC_MULTI2])
                                input_report_key(dev + i, BTN_THUMB, s & data[5]);
+
+                       input_sync(dev + i);
                }
        }
 
@@ -398,6 +404,7 @@ static void gc_timer(unsigned long private)
 
                                input_report_key(dev + i, BTN_THUMBL, ~data[0] & 0x04);
                                input_report_key(dev + i, BTN_THUMBR, ~data[0] & 0x02);
+                               input_sync(dev + i);
 
                        case GC_PSX_NEGCON:
                        case GC_PSX_ANALOG:
@@ -414,6 +421,8 @@ static void gc_timer(unsigned long private)
                                input_report_key(dev + i, BTN_START,  ~data[0] & 0x08);
                                input_report_key(dev + i, BTN_SELECT, ~data[0] & 0x01);
 
+                               input_sync(dev + i);
+
                                break;
 
                        case GC_PSX_NORMAL:
@@ -427,6 +436,8 @@ static void gc_timer(unsigned long private)
                                input_report_key(dev + i, BTN_START,  ~data[0] & 0x08);
                                input_report_key(dev + i, BTN_SELECT, ~data[0] & 0x01);
 
+                               input_sync(dev + i);
+
                                break;
                }
        }
index 913a99cd3cdb400200882dcfe72d6d681b4de8f0..0e65a32d337f52aee9877adc8944bc68d6cfb254 100644 (file)
@@ -197,6 +197,8 @@ static void gf2k_read(struct gf2k *gf2k, unsigned char *data)
 
        for (i = 0; i < gf2k_pads[gf2k->id]; i++)
                input_report_key(dev, gf2k_btn_pad[i], (t >> i) & 1);
+
+       input_sync(dev);
 }
 
 /*
index ded9a272566e6fe55d90940f18a60ce50934aee6..9acf65af4e30671536040a101106d8a19efd0212 100644 (file)
@@ -276,6 +276,8 @@ static void grip_timer(unsigned long private)
 
 
                }
+
+               input_sync(dev);
        }
 
        mod_timer(&grip->timer, jiffies + GRIP_REFRESH_TIME);
index 0a22d4835240f477a696d19eeaa45aea8e320576..badc8c75170f9a235fae15ec61bc07e8c7bba3fa 100644 (file)
@@ -515,6 +515,10 @@ static void report_slot(struct grip_mp *grip, int slot)
        input_report_abs(dev, ABS_X, grip->xaxes[slot]);
        input_report_abs(dev, ABS_Y, grip->yaxes[slot]);
 
+       /* Tell the receiver of the events to process them */
+
+       input_sync(dev);
+
        grip->dirty[slot] = 0;
 }
 
index a53db244d98ec3edadd0cf4271ab70d1494f1089..456e19983f51ac2cbe668de8db74c3a0acc7516b 100644 (file)
@@ -147,6 +147,8 @@ static void guillemot_timer(unsigned long private)
                        input_report_key(dev, guillemot->type->btn[i], (data[2 + (i >> 3)] >> (i & 7)) & 1);
        }
 
+       input_sync(dev);
+
        mod_timer(&guillemot->timer, jiffies + GUILLEMOT_REFRESH_TIME);
 }
 
index 5527f376c093402d445222e3394c58836d553043..ad9c037f5ffe36283f3d701bc194193e71e2b018 100644 (file)
@@ -214,10 +214,13 @@ void iforce_process_packet(struct iforce *iforce, u16 cmd, unsigned char *data)
                                }
                        }
 
+                       input_sync(dev);
+
                        break;
 
                case 0x02:      /* status report */
                        input_report_key(dev, BTN_DEAD, data[0] & 0x02);
+                       input_sync(dev);
 
                        /* Check if an effect was just started or stopped */
                        i = data[1] & 0x7f;
index 749d012a9a0e7f91bb93299bd0bd5860e0a8b536..adc20ac50535ffe574736896f8d14443776953b1 100644 (file)
@@ -176,6 +176,8 @@ static void interact_timer(unsigned long private)
                }
        }
 
+       input_sync(dev);
+
        mod_timer(&interact->timer, jiffies + INTERACT_REFRESH_TIME);
 
 }
index f665ef76f47001ef06f192dee391bf53536110d1..1b31762f0abb1778888b40ba580da4db6bf38612 100644 (file)
@@ -107,6 +107,8 @@ static void magellan_process_packet(struct magellan* magellan)
                        for (i = 0; i < 9; i++) input_report_key(dev, magellan_buttons[i], (t >> i) & 1);
                        break;
        }
+
+       input_sync(dev);
 }
 
 static void magellan_interrupt(struct serio *serio, unsigned char data, unsigned int flags)
index f3f2b0e152aa19f43479f96e5e8b319492709e16..e24db2de61f144f206ac6f4104c3b231e8ddc170 100644 (file)
@@ -323,6 +323,8 @@ static int sw_parse(unsigned char *buf, struct sw *sw)
                        input_report_key(dev, BTN_BASE4, !GB(38,1));
                        input_report_key(dev, BTN_BASE5, !GB(37,1));
 
+                       input_sync(dev);
+
                        return 0;
 
                case SW_ID_GP:
@@ -336,6 +338,8 @@ static int sw_parse(unsigned char *buf, struct sw *sw)
 
                                for (j = 0; j < 10; j++)
                                        input_report_key(dev + i, sw_btn[SW_ID_GP][j], !GB(i*15+j+4,1));
+
+                               input_sync(dev + i);
                        }
 
                        return 0;
@@ -356,6 +360,8 @@ static int sw_parse(unsigned char *buf, struct sw *sw)
                        for (j = 0; j < 9; j++)
                                input_report_key(dev, sw_btn[SW_ID_PP][j], !GB(j,1));
 
+                       input_sync(dev);
+
                        return 0;
 
                case SW_ID_FSP:
@@ -377,6 +383,8 @@ static int sw_parse(unsigned char *buf, struct sw *sw)
                        input_report_key(dev, BTN_MODE,   GB(38,1));
                        input_report_key(dev, BTN_SELECT, GB(39,1));
 
+                       input_sync(dev);
+
                        return 0;
 
                case SW_ID_FFW:
@@ -390,6 +398,8 @@ static int sw_parse(unsigned char *buf, struct sw *sw)
                        for (j = 0; j < 8; j++)
                                input_report_key(dev, sw_btn[SW_ID_FFW][j], !GB(j+22,1));
 
+                       input_sync(dev);
+
                        return 0;
        }
 
index 07b3ae5189e40a6725c06f01ddd0c462c3680d10..af8a2d7c1157072670a6749dc29628f3cf5410e7 100644 (file)
@@ -137,6 +137,8 @@ static void spaceball_process_packet(struct spaceball* spaceball)
                        printk(KERN_ERR "spaceball: Bad command. [%s]\n", spaceball->data + 1);
                        break;
        }
+
+       input_sync(dev);
 }
 
 /*
index 3edd004508a880622d6de0ce6ba0ebd44609e903..1e38bf9e7c38764836c8b4d724be646335737912 100644 (file)
@@ -124,6 +124,8 @@ static void spaceorb_process_packet(struct spaceorb *spaceorb)
                        printk("]\n");
                        break;
        }
+
+       input_sync(dev);
 }
 
 static void spaceorb_interrupt(struct serio *serio, unsigned char data, unsigned int flags)
index 4df08be9834828dd93feb870371a5a38172c7679..912db299a081089e40647a3ee083a28f759d057a 100644 (file)
@@ -85,6 +85,8 @@ static void stinger_process_packet(struct stinger *stinger)
        input_report_abs(dev, ABS_X, (data[1] & 0x3F) - ((data[0] & 0x01) << 6));
        input_report_abs(dev, ABS_Y, ((data[0] & 0x02) << 5) - (data[2] & 0x3F));
 
+       input_sync(dev);
+
        return;
 }
 
index bf592bdf2c2680ecbaec255a004bab96e98dd129..93efe7520fcfb3b8911d81cb8c52404d08e74f26 100644 (file)
@@ -214,6 +214,8 @@ static void tmdc_timer(unsigned long private)
                                                ((data[j][tmdc_byte_d[k]] >> (i + tmdc->btno[j][k])) & 1));
                                l += tmdc->btnc[j][k];
                        }
+
+                       input_sync(dev);
        }
 
        tmdc->bads += bad;
index f579cdd313896ea03f21c899dac844406d5bb737..5ad4f8e44f8ca91cafb338d3bcc2f31a1ad605c5 100644 (file)
@@ -101,6 +101,8 @@ static void tgfx_timer(unsigned long private)
                        input_report_key(dev, BTN_THUMB2,  (data2 & TGFX_THUMB2 ));
                        input_report_key(dev, BTN_TOP,     (data2 & TGFX_TOP    ));
                        input_report_key(dev, BTN_TOP2,    (data2 & TGFX_TOP2   ));
+
+                       input_sync(dev);
                }
 
        mod_timer(&tgfx->timer, jiffies + TGFX_REFRESH_TIME);
index 597441158b049d9ca0e9fcf1283709cdbe70467b..eefc596ff96e46a3e5c78de80c06918b89cdf936 100644 (file)
@@ -127,6 +127,8 @@ static void twidjoy_process_packet(struct twidjoy *twidjoy)
 
                input_report_abs(dev, ABS_X, -abs_x);
                input_report_abs(dev, ABS_Y, +abs_y);
+
+               input_sync(dev);
        }
 
        return;
index d9327000384a86e5bf7b08da5de6be6b620f5553..26205018393d48c9b8de7eade430adff51848073 100644 (file)
@@ -76,18 +76,19 @@ static void warrior_process_packet(struct warrior *warrior)
                        input_report_key(dev, BTN_THUMB,   (data[3] >> 1) & 1);
                        input_report_key(dev, BTN_TOP,     (data[3] >> 2) & 1);
                        input_report_key(dev, BTN_TOP2,    (data[3] >> 3) & 1);
-                       return;
+                       break;
                case 3:                                 /* XY-axis info->data */
                        input_report_abs(dev, ABS_X, ((data[0] & 8) << 5) - (data[2] | ((data[0] & 4) << 5)));
                        input_report_abs(dev, ABS_Y, (data[1] | ((data[0] & 1) << 7)) - ((data[0] & 2) << 7));
-                       return;
+                       break;
                case 5:                                 /* Throttle, spinner, hat info->data */
                        input_report_abs(dev, ABS_THROTTLE, (data[1] | ((data[0] & 1) << 7)) - ((data[0] & 2) << 7));
                        input_report_abs(dev, ABS_HAT0X, (data[3] & 2 ? 1 : 0) - (data[3] & 1 ? 1 : 0));
                        input_report_abs(dev, ABS_HAT0Y, (data[3] & 8 ? 1 : 0) - (data[3] & 4 ? 1 : 0));
                        input_report_rel(dev, REL_DIAL,  (data[2] | ((data[0] & 4) << 5)) - ((data[0] & 8) << 5));
-                       return;
+                       break;
        }
+       input_sync(dev);
 }
 
 /*
index 6655e917b9766bd838d0cdddb42f8c35649f0bb2..ba783d81e30a60784421c8b8bf40e306921481e2 100644 (file)
@@ -132,11 +132,10 @@ void keybdev_ledfunc(unsigned int led)
        struct input_handle *handle;    
 
        for (handle = keybdev_handler.handle; handle; handle = handle->hnext) {
-
                input_event(handle->dev, EV_LED, LED_SCROLLL, !!(led & 0x01));
                input_event(handle->dev, EV_LED, LED_NUML,    !!(led & 0x02));
                input_event(handle->dev, EV_LED, LED_CAPSL,   !!(led & 0x04));
-
+               input_sync(handle->dev);
        }
 }
 
index 474289eb27e16fd6652e4967ebbcdb1a425089ac..fcd76c358147893c53dd1c00854017882a8bf218 100644 (file)
@@ -88,10 +88,12 @@ static void amikbd_interrupt(int irq, void *dummy, struct pt_regs *fp)
                if (scancode == KEY_CAPS) {     /* CapsLock is a toggle switch key on Amiga */
                        input_report_key(&amikbd_dev, scancode, 1);
                        input_report_key(&amikbd_dev, scancode, 0);
+                       input_sync(&amikbd_dev);
                        return;
                }
                
                input_report_key(&amikbd_dev, scancode, down);
+               input_sync(&amikbd_dev);
 
                return;
        }
index 0b7c3f674a8f7b01629b849456bd7f99a0329d9e..8817c78887b84b95d0da35193ed16d4eaa35c220 100644 (file)
@@ -195,6 +195,7 @@ static void atkbd_interrupt(struct serio *serio, unsigned char data, unsigned in
                        break;
                default:
                        input_report_key(&atkbd->dev, atkbd->keycode[code], !atkbd->release);
+                       input_sync(&atkbd->dev);
        }
                
        atkbd->release = 0;
index df5a2d83bd39ef83775ca736e31371f50dafdb8c..9793ba27b64400d6a5f369c9d76b9d52ad9750f1 100644 (file)
@@ -76,6 +76,8 @@ static void dc_scan_kbd(struct dc_kbd *kbd)
                }
        }
 
+       input_sync(dev);
+
        memcpy(kbd->old, kbd->new, 8);
 }
 
index d9161dbc8c54818bc3e459ec15ffcda86c66b117..2c7fff08b1ab4bdc4fbc0d33e4a69a77615b5f94 100644 (file)
@@ -72,6 +72,8 @@ void nkbd_interrupt(struct serio *serio, unsigned char data, unsigned int flags)
 
        else if (data == 0xe7) /* end of init sequence */
                printk(KERN_INFO "input: %s on %s\n", nkbd_name, serio->phys);
+
+       input_sync(&nkbd->dev);
 }
 
 void nkbd_connect(struct serio *serio, struct serio_dev *dev)
index 63cda43669f6bed041c32b2025e7996eaea3d9a6..b8c48f0e8dfcdf1bc1bfc3a807d08616db50a846 100644 (file)
@@ -161,6 +161,7 @@ static void ps2serkbd_interrupt(struct serio *serio, unsigned char data, unsigne
         break;
     default:
         input_report_key(&ps2serkbd->dev, ps2serkbd->keycode[code], !ps2serkbd->release);
+       input_sync(&ps2serkbd->dev);
     }
 
     ps2serkbd->release = 0;
index 4857ba2fe37246bd93c14430eb3cace8ea22a584..8e41f20ad5906d049ddf46c638d606e0f380316f 100644 (file)
@@ -121,6 +121,7 @@ static void sunkbd_interrupt(struct serio *serio, unsigned char data, unsigned i
                default:
                        if (sunkbd->keycode[data & SUNKBD_KEY]) {
                                 input_report_key(&sunkbd->dev, sunkbd->keycode[data & SUNKBD_KEY], !(data & SUNKBD_RELEASE));
+                               input_sync(&sunkbd->dev);
                         } else {
                                 printk(KERN_WARNING "sunkbd.c: Unknown key (scancode %#x) %s.\n",
                                         data & SUNKBD_KEY, data & SUNKBD_RELEASE ? "released" : "pressed");
index d8f6c17edd8e28f03a7ad31122ca09e072d8a316..bcf4eb098fdf1c97950ddf1a11d6da361bbf53fb 100644 (file)
@@ -75,6 +75,7 @@ void xtkbd_interrupt(struct serio *serio, unsigned char data, unsigned int flags
 
                        if (xtkbd->keycode[data & XTKBD_KEY]) {
                                input_report_key(&xtkbd->dev, xtkbd->keycode[data & XTKBD_KEY], !(data & XTKBD_RELEASE));
+                               input_sync(&xtkbd->dev);
                        } else {
                                printk(KERN_WARNING "xtkbd.c: Unknown key (scancode %#x) %s.\n",
                                        data & XTKBD_KEY, data & XTKBD_RELEASE ? "released" : "pressed");
index 6b6a92c9ede70c2ced15ea23317d054455058cbb..3a0d8d1041ca0f873e12c1b8b9a947c0b086dbaa 100644 (file)
@@ -68,6 +68,8 @@ static void amimouse_interrupt(int irq, void *dummy, struct pt_regs *fp)
        input_report_key(&amimouse_dev, BTN_LEFT,   ciaa.pra & 0x40);
        input_report_key(&amimouse_dev, BTN_MIDDLE, potgor & 0x0100);
        input_report_key(&amimouse_dev, BTN_RIGHT,  potgor & 0x0400);
+
+       input_sync(&amimouse_dev);
 }
 
 static int amimouse_open(struct input_dev *dev)
index 51fba4dceb6da52d953fc999975d975b47de157f..11706c6ce14b6bd4b140f535b0dd3a9f20aaff53 100644 (file)
@@ -139,6 +139,8 @@ static void inport_interrupt(int irq, void *dev_id, struct pt_regs *regs)
 
        outb(INPORT_REG_MODE, INPORT_CONTROL_PORT);
        outb(INPORT_MODE_IRQ | INPORT_MODE_BASE, INPORT_DATA_PORT);
+
+       input_sync(&inport_dev);
 }
 
 #ifndef MODULE
index afdc1afcc75835bc7f98a68710c164f9cf00f88f..f00dce583e7afdad1491e838099955b164a84de8 100644 (file)
@@ -128,6 +128,8 @@ static void logibm_interrupt(int irq, void *dev_id, struct pt_regs *regs)
        input_report_key(&logibm_dev, BTN_RIGHT,  buttons & 1);
        input_report_key(&logibm_dev, BTN_MIDDLE, buttons & 2);
        input_report_key(&logibm_dev, BTN_LEFT,   buttons & 4);
+       input_sync(&logibm_dev);
+
        outb(LOGIBM_ENABLE_IRQ, LOGIBM_CONTROL_PORT);
 }
 
index 2c434ecaf28674e9031601bed0b01d405d5bb336..6034a560da0afd5857c50e6bd54209a6a24ce88f 100644 (file)
@@ -40,6 +40,7 @@ static void dc_mouse_callback(struct mapleq *mq)
        input_report_rel(dev, REL_X,      relx);
        input_report_rel(dev, REL_Y,      rely);
        input_report_rel(dev, REL_WHEEL,  relz);
+       input_sync(dev);
 }
 
 
index ce4e992c46607687d58bc207030f363fa09e7157..b0a6d4cba4e2feae07e030ab0bf168e6cbef34a4 100644 (file)
@@ -78,6 +78,7 @@ static void pc110pad_interrupt(int irq, void *ptr, struct pt_regs *regs)
                pc110pad_data[1] | ((pc110pad_data[0] << 3) & 0x80) | ((pc110pad_data[0] << 1) & 0x100));
        input_report_abs(&pc110pad_dev, ABS_Y,
                pc110pad_data[2] | ((pc110pad_data[0] << 4) & 0x80));
+       input_sync(&pc110pad_dev);
 
        pc110pad_count = 0;
 }
@@ -90,8 +91,6 @@ static void pc110pad_close(struct input_dev *dev)
 
 static int pc110pad_open(struct input_dev *dev)
 {
-       unsigned long flags;
-       
        if (pc110pad_used++)
                return 0;
 
index ff7a8b0170d813a941eb5768f3c4dfb57f354726..d19c9ce6d4bf6db01bd14273e5f9720dab5fdeb7 100644 (file)
@@ -167,6 +167,7 @@ static void psmouse_process_packet(struct psmouse *psmouse)
        input_report_rel(dev, REL_X, packet[1] ? (int) packet[1] - (int) ((packet[0] << 4) & 0x100) : 0);
        input_report_rel(dev, REL_Y, packet[2] ? (int) ((packet[0] << 3) & 0x100) - (int) packet[2] : 0);
 
+       input_sync(dev);
 }
 
 /*
index 31a892a524606fdb104e3162cb1d208a861713ad..3a168614522cc6d642be0e348c1ca5c74f55a9d7 100644 (file)
@@ -63,6 +63,8 @@ static void rpcmouse_irq(int irq, void *dev_id, struct pt_regs *regs)
        input_report_key(&rpcmouse_dev, BTN_LEFT,   b & 0x10);
        input_report_key(&rpcmouse_dev, BTN_MIDDLE, b & 0x20);
        input_report_key(&rpcmouse_dev, BTN_RIGHT,  b & 0x40);
+
+       input_sync(&rpcmouse_dev);
 }
 
 static int __init rpcmouse_init(void)
index fded500e04a946062e60ff1951db0149f80b65b8..abe2fe7dd3271a2ba5e76c1c257f5fa4fbebc8f6 100644 (file)
@@ -89,6 +89,8 @@ static void sermouse_process_msc(struct sermouse *sermouse, signed char data)
                        break;
        }
 
+       input_sync(dev);
+
        if (++sermouse->count == (5 - ((sermouse->type == SERIO_SUN) << 1)))
                sermouse->count = 0;
 }
@@ -188,6 +190,8 @@ static void sermouse_process_ms(struct sermouse *sermouse, signed char data)
                        break;
        }
 
+       input_sync(dev);
+
        sermouse->count++;
 }
 
index cb81a373f3c07bfda6de5e6217dffdedbc872f8e..debd3b3e29573bff5993608c30f4edb6e8f9b40b 100644 (file)
@@ -94,9 +94,10 @@ static void mousedev_event(struct input_handle *handle, unsigned int type, unsig
        struct mousedev *mousedevs[3] = { handle->private, &mousedev_mix, NULL };
        struct mousedev **mousedev = mousedevs;
        struct mousedev_list *list;
-       int index, size;
+       int index, size, wake;
 
        while (*mousedev) {
+               wake = 0;
                list = (*mousedev)->list;
                while (list) {
                        switch (type) {
@@ -158,16 +159,20 @@ static void mousedev_event(struct input_handle *handle, unsigned int type, unsig
                                                case 2: return;
                                        }
                                        break;
-                       }
-                                       
-                       list->ready = 1;
-
-                       kill_fasync(&list->fasync, SIGIO, POLL_IN);
 
+                               case EV_SYN:
+                                       switch (code) {
+                                               case SYN_REPORT:
+                                                       list->ready = 1;
+                                                       kill_fasync(&list->fasync, SIGIO, POLL_IN);
+                                                       wake = 1;
+                                                       break;
+                                       }
+                       }
                        list = list->next;
                }
-
-               wake_up_interruptible(&((*mousedev)->wait));
+               if (wake)
+                       wake_up_interruptible(&((*mousedev)->wait));
                mousedev++;
        }
 }
index 268ea18b5e63f8c13a8d4965d723feb9220b90c9..6e512b7241c41bd8ed86481bc891234facb41b20 100644 (file)
@@ -74,6 +74,7 @@ static void gunze_process_packet(struct gunze* gunze)
        input_report_abs(dev, ABS_X, simple_strtoul(gunze->data + 1, NULL, 10) * 4);
        input_report_abs(dev, ABS_Y, 3072 - simple_strtoul(gunze->data + 6, NULL, 10) * 3);
        input_report_key(dev, BTN_TOUCH, gunze->data[0] == 'T');
+       input_sync(dev);
 }
 
 static void gunze_interrupt(struct serio *serio, unsigned char data, unsigned int flags)
index 5f93359a578c4ffca3c44c0102e46175a188c106..21c3f3a16407c4f1821411614ecd46c18866a4b8 100644 (file)
@@ -109,6 +109,7 @@ static void action_button_handler(int irq, void *dev_id, struct pt_regs *regs)
        struct input_dev *dev = (struct input_dev *) dev_id;
 
        input_report_key(dev, KEY_ENTER, down);
+       input_sync(dev);
 }
 
 static void npower_button_handler(int irq, void *dev_id, struct pt_regs *regs)
@@ -122,6 +123,7 @@ static void npower_button_handler(int irq, void *dev_id, struct pt_regs *regs)
         */     
        input_report_key(dev, KEY_SUSPEND, 1);
        input_report_key(dev, KEY_SUSPEND, down);       
+       input_sync(dev);
 }
 
 #ifdef CONFIG_PM
@@ -267,6 +269,8 @@ static void h3600ts_process_packet(struct h3600_dev *ts)
                        /* Send a non input event elsewhere */
                        break;
         }
+
+       input_sync(dev);
 }
 
 /*
index 85670d5c6d38099e40287c54ab84e680b3e08843..82543e0188bc2373044a614f1b05850ce8b9ffda 100644 (file)
@@ -163,6 +163,8 @@ adbhid_input_keycode(int id, int keycode, int repeat)
        else
                printk(KERN_INFO "Unhandled ADB key (scancode %#02x) %s.\n", keycode,
                       up_flag ? "released" : "pressed");
+
+       input_sync(&adbhid[id]->input);
 }
 
 static void
@@ -259,6 +261,8 @@ adbhid_mouse_input(unsigned char *data, int nb, struct pt_regs *regs, int autopo
                         ((data[2]&0x7f) < 64 ? (data[2]&0x7f) : (data[2]&0x7f)-128 ));
        input_report_rel(&adbhid[id]->input, REL_Y,
                         ((data[1]&0x7f) < 64 ? (data[1]&0x7f) : (data[1]&0x7f)-128 ));
+
+       input_sync(&adbhid[id]->input);
 }
 
 static void
@@ -363,6 +367,8 @@ adbhid_buttons_input(unsigned char *data, int nb, struct pt_regs *regs, int auto
          }
          break;
        }
+
+       input_sync(&adbhid[id]->input);
 }
 
 static struct adb_request led_request;
index 41e4dbb5ce8535e16ed400ac25d625e46f0d3a64..60a0592f871056599c55736521f35420602f2692 100644 (file)
@@ -162,6 +162,7 @@ int mac_hid_mouse_emulate_buttons(int caller, unsigned int keycode, int down)
                                input_report_key(&emumousebtn,
                                                 keycode == mouse_button2_keycode ? BTN_MIDDLE : BTN_RIGHT,
                                                 down);
+                               input_sync(&emumousebtn);
                                return 1;
                        }
                        mouse_last_keycode = down ? keycode : 0;
index f869b223116d53c2a009d89f86a94f55cf50b00b..48d5e86b268dfd9a3d5358e4447cc523fa302496 100644 (file)
@@ -161,6 +161,8 @@ aiptek_irq(struct urb *urb)
                input_report_key(dev, BTN_STYLUS2, data[5] & 0x10);
        }
 
+       input_sync(dev);
+
 }
 
 struct aiptek_features aiptek_features[] = {
index 19b6ff130bafa068d236ef239634ff47963188ea..8c941083376c1da97237da53a051b33147e7fed7 100644 (file)
@@ -903,6 +903,9 @@ static int hid_input_report(int type, struct urb *urb)
        for (n = 0; n < report->maxfield; n++)
                hid_input_field(hid, report->field[n], data);
 
+       if (hid->claimed & HID_CLAIMED_INPUT)
+               hidinput_report_event(hid, report);
+
        return 0;
 }
 
index 4ffdec218fd59e3c40e30e63ad1d807ce910bc2a..9090b577643fd6b36bf33a1a6d7b64b6e9dcf5d0 100644 (file)
@@ -428,6 +428,11 @@ void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct
                input_event(input, usage->type, usage->code, 0);
 }
 
+void hidinput_report_event(struct hid_device *hid, struct hid_report *report)
+{
+       input_sync(&hid->input);
+}
+
 static int hidinput_input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value)
 {
        struct hid_device *hid = dev->private;
index 93075dee2db759944d3e30cf806ee8405e418b22..566232f6415f91ca5677ec8842aaeb15c0d20e24 100644 (file)
@@ -416,11 +416,13 @@ struct hid_descriptor {
 /* We ignore a few input applications that are not widely used */
 #define IS_INPUT_APPLICATION(a) (((a >= 0x00010000) && (a <= 0x00010008)) || ( a == 0x00010080) || ( a == 0x000c0001))
 extern void hidinput_hid_event(struct hid_device *, struct hid_field *, struct hid_usage *, __s32);
+extern void hidinput_report_event(struct hid_device *hid, struct hid_report *report);
 extern int hidinput_connect(struct hid_device *);
 extern void hidinput_disconnect(struct hid_device *);
 #else
 #define IS_INPUT_APPLICATION(a) (0)
 static inline void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct hid_usage *usage, __s32 value) { }
+static inline void hidinput_report_event(struct hid_device *hid, struct hid_report *report) { }
 static inline int hidinput_connect(struct hid_device *hid) { return -ENODEV; }
 static inline void hidinput_disconnect(struct hid_device *hid) { }
 #endif
index 79dcc55c771721d5ca6e5a474812f849aa666595..e24862884e53276af1b109bcf20ae2b6a66a52dd 100644 (file)
@@ -83,6 +83,7 @@ static void powermate_irq(struct urb *urb)
        /* handle updates to device state */
        input_report_key(&pm->input, BTN_0, pm->data[0] & 0x01);
        input_report_rel(&pm->input, REL_DIAL, pm->data[1]);
+       input_sync(&pm->input);
 }
 
 /* Decide if we need to issue a control message and do so. Must be called with pm->lock down */
index bf42555c0d1824c6a6c8e8fc6c17c1ea236fb3b2..dccb13bd811a75c65c51b61d43dc2cb8e108f11f 100644 (file)
@@ -104,6 +104,8 @@ static void usb_kbd_irq(struct urb *urb)
                }
        }
 
+       input_sync(&kbd->dev);
+
        memcpy(kbd->old, kbd->new, 8);
 }
 
@@ -236,7 +238,7 @@ static void *usb_kbd_probe(struct usb_device *dev, unsigned int ifnum,
 
        kbd->dev.name = kbd->name;
        kbd->dev.phys = kbd->phys;      
-       kbd->dev.id.bus = BUS_USB;
+       kbd->dev.id.bustype = BUS_USB;
        kbd->dev.id.vendor = dev->descriptor.idVendor;
        kbd->dev.id.product = dev->descriptor.idProduct;
        kbd->dev.id.version = dev->descriptor.bcdDevice;
index 37da58d9ad655a052a020771b1473d48b4da450e..c72e498ee7a59debc75f6aff6fa7d39a05d5be5b 100644 (file)
@@ -72,6 +72,8 @@ static void usb_mouse_irq(struct urb *urb)
        input_report_rel(dev, REL_X,     data[1]);
        input_report_rel(dev, REL_Y,     data[2]);
        input_report_rel(dev, REL_WHEEL, data[3]);
+
+       input_sync(dev);
 }
 
 static int usb_mouse_open(struct input_dev *dev)
@@ -145,7 +147,7 @@ static void *usb_mouse_probe(struct usb_device *dev, unsigned int ifnum,
 
        mouse->dev.name = mouse->name;
        mouse->dev.phys = mouse->phys;
-       mouse->dev.id.bus = BUS_USB;
+       mouse->dev.id.bustype = BUS_USB;
        mouse->dev.id.vendor = dev->descriptor.idVendor;
        mouse->dev.id.product = dev->descriptor.idProduct;
        mouse->dev.id.version = dev->descriptor.bcdDevice;
index 2fdac6221282bc185a5ae70d1f69a79efb300665..e4a3b59f5668512c258a4cd11d7558cfcff3ec21 100644 (file)
@@ -136,6 +136,7 @@ static void wacom_pl_irq(struct urb *urb)
        }
        
        input_event(dev, EV_MSC, MSC_SERIAL, 0);
+       input_sync(dev);
 }
 
 static void wacom_graphire_irq(struct urb *urb)
@@ -189,6 +190,8 @@ static void wacom_graphire_irq(struct urb *urb)
        input_report_key(dev, BTN_STYLUS2, data[1] & 0x04);
 
        input_event(dev, EV_MSC, MSC_SERIAL, data[1] & 0x01);
+
+       input_sync(dev);
 }
 
 static void wacom_intuos_irq(struct urb *urb)
@@ -291,6 +294,8 @@ static void wacom_intuos_irq(struct urb *urb)
        }
        
        input_event(dev, EV_MSC, MSC_SERIAL, wacom->serial[idx]);
+
+       input_sync(dev);
 }
 
 #define WACOM_INTUOS_TOOLS     (BIT(BTN_TOOL_BRUSH) | BIT(BTN_TOOL_PENCIL) | BIT(BTN_TOOL_AIRBRUSH) | BIT(BTN_TOOL_LENS))
index b7651315df08aaa92390cf8dd98ed8a2d1501de7..445741a489ba67534e469550b7e6936675f697cb 100644 (file)
@@ -158,6 +158,8 @@ static void xpad_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned char *d
        /* "analog" buttons black, white */
        input_report_key(dev, BTN_C, data[8]);
        input_report_key(dev, BTN_Z, data[9]);
+
+       input_sync(dev);
 }
 
 static void xpad_irq_in(struct urb *urb)
index 7d413abc26b3cb588a3a4609efab914c3837b4b6..938fab4e3c483316eb6d936966f361edd8f1819c 100644 (file)
@@ -57,10 +57,10 @@ struct input_event {
  */
 
 struct input_devinfo {
-       uint16_t bustype;
-       uint16_t vendor;
-       uint16_t product;
-       uint16_t version;
+       __u16 bustype;
+       __u16 vendor;
+       __u16 product;
+       __u16 version;
 };
 
 #define EVIOCGVERSION          _IOR('E', 0x01, int)                    /* get driver version */
@@ -89,7 +89,7 @@ struct input_devinfo {
  * Event types
  */
 
-#define EV_RST                 0x00
+#define EV_SYN                 0x00
 #define EV_KEY                 0x01
 #define EV_REL                 0x02
 #define EV_ABS                 0x03
@@ -102,6 +102,13 @@ struct input_devinfo {
 #define EV_FF_STATUS           0x17
 #define EV_MAX                 0x1f
 
+/*
+ * Synchronization events.
+ */
+
+#define SYN_REPORT             0
+#define SYN_CONFIG             1
+
 /*
  * Keys and buttons
  */
@@ -769,6 +776,8 @@ struct input_dev {
        struct pm_dev *pm_dev;
        int state;
 
+       int sync;
+
        int abs[ABS_MAX + 1];
        int rep[REP_MAX + 1];
 
@@ -883,6 +892,7 @@ void input_unregister_minor(devfs_handle_t handle);
 
 void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value);
 
+#define input_sync(a)          input_event(a, EV_SYN, SYN_REPORT, 0)
 #define input_report_key(a,b,c) input_event(a, EV_KEY, b, !!(c))
 #define input_report_rel(a,b,c) input_event(a, EV_REL, b, c)
 #define input_report_abs(a,b,c) input_event(a, EV_ABS, b, c)