27 #include <linux/pci.h>
31 #define MOUSE_X_MAX 1600
32 #define MOUSE_Y_MAX 1200
34 static const unsigned short xlate_high[
XLATE_SIZE] = {
84 static const unsigned short xlate[
XLATE_SIZE] = {
140 dbg(
"remote mouse movement: (x,y)=(%d,%d)%s%s%s%s\n",
142 (buttons) ?
" -- buttons:" :
"",
148 dbg(
"remote keypress (code, flag, down):"
149 "%d (0x%x) [0x%x] [0x%x]\n",
158 static void send_mouse_event(
struct input_dev *
dev,
struct remote_input *input)
170 static void send_keyboard_event(
struct input_dev *
dev,
177 key = xlate_high[code & 0xff];
180 input_report_key(dev, key, input->
data.
keyboard.key_down);
186 unsigned long reader;
193 while (reader != writer) {
199 send_mouse_event(sp->
remote.mouse_dev, &input);
201 send_keyboard_event(sp->
remote.keybd_dev, &input);
205 reader = advance_queue_reader(sp, reader);
213 struct input_dev *mouse_dev, *keybd_dev;
218 sp->
remote.mouse_dev = mouse_dev = input_allocate_device();
219 sp->
remote.keybd_dev = keybd_dev = input_allocate_device();
221 if (!mouse_dev || !keybd_dev)
222 goto err_free_devices;
224 mouse_dev->id.bustype =
BUS_PCI;
225 mouse_dev->id.vendor = pdev->
vendor;
226 mouse_dev->id.product = pdev->
device;
227 mouse_dev->id.version = 1;
228 mouse_dev->dev.parent = sp->
dev;
233 mouse_dev->name =
"ibmasm RSA I remote mouse";
237 keybd_dev->id.bustype =
BUS_PCI;
238 keybd_dev->id.vendor = pdev->
vendor;
239 keybd_dev->id.product = pdev->
device;
240 keybd_dev->id.version = 2;
241 keybd_dev->dev.parent = sp->
dev;
243 keybd_dev->name =
"ibmasm RSA I remote keyboard";
247 set_bit(xlate_high[i], keybd_dev->keybit);
249 set_bit(xlate[i], keybd_dev->keybit);
252 error = input_register_device(mouse_dev);
254 goto err_free_devices;
256 error = input_register_device(keybd_dev);
258 goto err_unregister_mouse_dev;
266 err_unregister_mouse_dev:
267 input_unregister_device(mouse_dev);
270 input_free_device(mouse_dev);
271 input_free_device(keybd_dev);
279 input_unregister_device(sp->
remote.mouse_dev);
280 input_unregister_device(sp->
remote.keybd_dev);