From 56e83718f09101e671eb6e94f16738dec359e852 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 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c index 2d7f691ec71c..d438bd1a2b77 100644 --- a/drivers/input/mousedev.c +++ b/drivers/input/mousedev.c @@ -27,6 +27,7 @@ #include #include #include +#include MODULE_AUTHOR("Vojtech Pavlik "); MODULE_DESCRIPTION("Mouse (ExplorerPS/2) device interfaces"); @@ -720,7 +721,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 && @@ -748,6 +750,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