aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/mousedev.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/mousedev.c')
-rw-r--r--drivers/input/mousedev.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c
index 412fa71245af..7dafd4d91355 100644
--- a/drivers/input/mousedev.c
+++ b/drivers/input/mousedev.c
@@ -27,6 +27,7 @@
#include <linux/device.h>
#include <linux/cdev.h>
#include <linux/kernel.h>
+#include <asm/byteorder.h>
MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_DESCRIPTION("Mouse (ExplorerPS/2) device interfaces");
@@ -721,7 +722,8 @@ static ssize_t mousedev_read(struct file *file, char __user *buffer,
{
struct mousedev_client *client = file->private_data;
struct mousedev *mousedev = client->mousedev;
- u8 data[sizeof(client->ps2)];
+ u16 data[sizeof(client->ps2)];
+
int retval = 0;
if (!client->ready && !client->buffer && mousedev->exist &&
@@ -749,6 +751,11 @@ static ssize_t mousedev_read(struct file *file, char __user *buffer,
memcpy(data, client->ps2 + client->bufsiz - client->buffer, count);
client->buffer -= count;
+#ifdef CONFIG_CPU_BIG_ENDIAN
+ /* Force mouse data LE in userspace as consumers
+ of the data expect it in this format */
+ cpu_to_le16p((__u16 *)data);
+#endif
spin_unlock_irq(&client->packet_lock);
if (copy_to_user(buffer, data, count))