Skip to content

Commit 278218f

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Pull input fixes from Dmitry Torokhov: "Two small fixups for spaceball joystick driver and appletouch touchpad driver" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: Input: spaceball - fix parsing of movement data packets Input: appletouch - initialize work before device registration
2 parents 8008293 + bc7ec91 commit 278218f

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

drivers/input/joystick/spaceball.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <linux/module.h>
2020
#include <linux/input.h>
2121
#include <linux/serio.h>
22+
#include <asm/unaligned.h>
2223

2324
#define DRIVER_DESC "SpaceTec SpaceBall 2003/3003/4000 FLX driver"
2425

@@ -75,9 +76,15 @@ static void spaceball_process_packet(struct spaceball* spaceball)
7576

7677
case 'D': /* Ball data */
7778
if (spaceball->idx != 15) return;
78-
for (i = 0; i < 6; i++)
79+
/*
80+
* Skip first three bytes; read six axes worth of data.
81+
* Axis values are signed 16-bit big-endian.
82+
*/
83+
data += 3;
84+
for (i = 0; i < ARRAY_SIZE(spaceball_axes); i++) {
7985
input_report_abs(dev, spaceball_axes[i],
80-
(__s16)((data[2 * i + 3] << 8) | data[2 * i + 2]));
86+
(__s16)get_unaligned_be16(&data[i * 2]));
87+
}
8188
break;
8289

8390
case 'K': /* Button data */

drivers/input/mouse/appletouch.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -916,15 +916,15 @@ static int atp_probe(struct usb_interface *iface,
916916
set_bit(BTN_TOOL_TRIPLETAP, input_dev->keybit);
917917
set_bit(BTN_LEFT, input_dev->keybit);
918918

919+
INIT_WORK(&dev->work, atp_reinit);
920+
919921
error = input_register_device(dev->input);
920922
if (error)
921923
goto err_free_buffer;
922924

923925
/* save our data pointer in this interface device */
924926
usb_set_intfdata(iface, dev);
925927

926-
INIT_WORK(&dev->work, atp_reinit);
927-
928928
return 0;
929929

930930
err_free_buffer:

0 commit comments

Comments
 (0)