From 7b532ebf41b9009bcff5e19a2a234e4234428fc9 Mon Sep 17 00:00:00 2001 From: Richard Griffiths Date: Tue, 21 Sep 2010 13:22:55 -0700 Subject: [PATCH] mousedev: mousedev patch for qemumips The consumers of the mousedev data in MIPS uperspace assume that the data is little endian. So if we are running on a big endian CPU we force the output data to be little endian. Note: this may be reverted if/when the consuming devices add options, or options are found that can byte swap the data in userspace. This is simply a commit of convienience to demonstrate an issue. Signed-off-by: Richard Griffiths Signed-off-by: Bruce Ashfield --- drivers/input/mousedev.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c index b604564dec5c..8311853200e8 100644 --- a/drivers/input/mousedev.c +++ b/drivers/input/mousedev.c @@ -26,6 +26,7 @@ #include #include #include +#include MODULE_AUTHOR("Vojtech Pavlik "); MODULE_DESCRIPTION("Mouse (ExplorerPS/2) device interfaces"); @@ -714,7 +715,7 @@ static ssize_t mousedev_read(struct file *file, char __user *buffer, { struct mousedev_client *client = file->private_data; struct mousedev *mousedev = client->mousedev; - signed char data[sizeof(client->ps2)]; + u16 data[sizeof(client->ps2)]; int retval = 0; if (!client->ready && !client->buffer && mousedev->exist && @@ -742,6 +743,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)) -- 2.5.0