PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
ps2mouse.c
Go to the documentation of this file.
1/*
2# _____ ___ ____ ___ ____
3# ____| | ____| | | |____|
4# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5#-----------------------------------------------------------------------
6# Copyright 2001-2004, ps2dev - http://www.ps2dev.org
7# Licenced under Academic Free License version 2.0
8# Review ps2sdk README & LICENSE files for further details.
9*/
10
16#include "types.h"
17#include "iomanX.h"
18#include "loadcore.h"
19#include "stdio.h"
20#include "sifcmd.h"
21#include "sifrpc.h"
22#include "sysclib.h"
23#include "sysmem.h"
24#include "usbd.h"
25#include "usbd_macro.h"
26#include "thbase.h"
27#include "thevent.h"
28#include "thsemap.h"
29
30#include "ps2mouse.h"
31
32#define MODNAME "PS2 USB mouse driver"
33
34IRX_ID(MODNAME, 1, 1);
35
36#define PS2MOUSE_VERSION 0x100
37
38#define USB_SUBCLASS_BOOT 1
39#define USB_HIDPROTO_MOUSE 2
40
41#define PS2MOUSE_MAXDEV 2
42#define PS2MOUSE_MAXBUTTONS 3
43
44#define PS2MOUSE_DEFDBLCLICK 500
45
46#define PS2MOUSE_DEFACCEL (1 << 16)
47#define PS2MOUSE_DEFTHRES 65536;
48
49static SifRpcDataQueue_t ps2mouse_queue __attribute__((aligned(16)));
50static SifRpcServerData_t ps2mouse_server __attribute__((aligned(16)));
51static int _rpc_buffer[512] __attribute__((__aligned__(4)));
52
53#define ABS(x) (x < 0 ? -x : x)
54
55void rpcMainThread(void* param);
56void *rpcCommandHandler(u32 command, void *buffer, int size);
57
58int ps2mouse_init();
59void ps2mouse_config_set(int resultCode, int bytes, void *arg);
60void ps2mouse_data_recv(int resultCode, int bytes, void *arg);
61int ps2mouse_probe(int devId);
62int ps2mouse_connect(int devId);
63int ps2mouse_disconnect(int devId);
64void usb_getstring(int endp, int index, char *desc);
65
66typedef struct _mouse_data_recv
67
68{
69 unsigned char buttons;
70 char x, y, wheel;
72
73typedef struct _mouse_dev
74
75{
76 int configEndp;
77 int dataEndp;
78 int packetSize;
79 int devId;
83 u32 timer[PS2MOUSE_MAXBUTTONS];
84} mouse_dev;
85
86/* Global Variables */
87
88int mouse_readmode;
89int mousex_min;
90int mousex_max;
91int mousey_min;
92int mousey_max;
93int mouse_thres;
94int mouse_accel;
95int mouse_dblclicktime;
96int mouse_sema;
100mouse_dev *devices[PS2MOUSE_MAXDEV];
101int dev_count;
102sceUsbdLddOps mouse_driver = { NULL, NULL, "PS2Mouse", ps2mouse_probe, ps2mouse_connect, ps2mouse_disconnect, 0, 0, 0, 0, 0, NULL };
103
104int _start (int argc, char *argv[])
105{
106 iop_thread_t param;
107 int th;
108
109 (void)argc;
110 (void)argv;
111
112 ps2mouse_init();
113
114 param.attr = TH_C;
115 param.thread = rpcMainThread;
116 param.priority = 40;
117 param.stacksize = 0x800;
118 param.option = 0;
119
120 th = CreateThread(&param);
121 if (th > 0) {
122 StartThread(th, NULL);
123 return MODULE_RESIDENT_END;
124 }
125 else return MODULE_NO_RESIDENT_END;
126}
127
128void rpcMainThread(void* param)
129{
130 int tid;
131
132 (void)param;
133
134 SifInitRpc(0);
135
136 //printf("PS2MOUSE - RPC Initialise\n");
137 printf("PS2MOUSE - USB Mouse Library\n");
138
139 tid = GetThreadId();
140 SifSetRpcQueue(&ps2mouse_queue, tid);
141 SifRegisterRpc(&ps2mouse_server, PS2MOUSE_BIND_RPC_ID, (void *) rpcCommandHandler, (u8 *) &_rpc_buffer, 0, 0, &ps2mouse_queue);
142 SifRpcLoop(&ps2mouse_queue);
143}
144
145int ps2mouse_probe(int devId)
146
147{
152 //UsbStringDescriptor *str;
153
154 if(dev_count >= PS2MOUSE_MAXDEV)
155 {
156 printf("ERROR: Maximum mouse devices reached\n");
157 return 0;
158 }
159
160 //printf("PS2Mouse_probe devId %d\n", devId);
161
162 dev = sceUsbdScanStaticDescriptor(devId, NULL, USB_DT_DEVICE); /* Get device descriptor */
163 if(!dev)
164 {
165 printf("ERROR: Couldn't get device descriptor\n");
166 return 0;
167 }
168
169 //printf("Device class %d, Size %d, Man %d, Product %d\n", dev->bDeviceClass, dev->bMaxPacketSize0, dev->iManufacturer, dev->iProduct);
170 /* Check that the device class is specified in the interfaces and it has at least one configuration */
171 if((dev->bDeviceClass != USB_CLASS_PER_INTERFACE) || (dev->bNumConfigurations < 1))
172 {
173 //printf("This is not the droid you're looking for\n");
174 return 0;
175 }
176
177 conf = sceUsbdScanStaticDescriptor(devId, dev, USB_DT_CONFIG);
178 if(!conf)
179 {
180 //printf("ERROR: Couldn't get configuration descriptor\n");
181 return 0;
182 }
183 //printf("Config Length %d Total %d Interfaces %d\n", conf->bLength, conf->wTotalLength, conf->bNumInterfaces);
184
185 if((conf->bNumInterfaces < 1) || (conf->wTotalLength < (sizeof(UsbConfigDescriptor) + sizeof(UsbInterfaceDescriptor))))
186 {
187 printf("ERROR: No interfaces available\n");
188 return 0;
189 }
190
191 intf = (UsbInterfaceDescriptor *) ((char *) conf + conf->bLength); /* Get first interface */
192/* printf("Interface Length %d Endpoints %d Class %d Sub %d Proto %d\n", intf->bLength, */
193/* intf->bNumEndpoints, intf->bInterfaceClass, intf->bInterfaceSubClass, */
194/* intf->bInterfaceProtocol); */
195
196 if((intf->bInterfaceClass != USB_CLASS_HID) || (intf->bInterfaceSubClass != USB_SUBCLASS_BOOT) ||
197 (intf->bInterfaceProtocol != USB_HIDPROTO_MOUSE) || (intf->bNumEndpoints < 1))
198 {
199 //printf("We came, we saw, we told it to fuck off\n");
200 return 0;
201 }
202
203 endp = (UsbEndpointDescriptor *) ((char *) intf + intf->bLength);
204 endp = (UsbEndpointDescriptor *) ((char *) endp + endp->bLength); /* Go to the data endpoint */
205
206 //printf("Endpoint 1 Addr %d, Attr %d, MaxPacket %d\n", endp->bEndpointAddress, endp->bmAttributes, endp->wMaxPacketSizeLB);
207
208 if(((endp->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_INT) ||
209 ((endp->bEndpointAddress & USB_ENDPOINT_DIR_MASK) != USB_DIR_IN))
210 {
211 printf("ERROR: Endpoint not interrupt type and/or an input\n");
212 return 0;
213 }
214
215 printf("PS2MOUSE: Found a mouse device\n");
216
217 return 1;
218}
219
220int ps2mouse_connect(int devId)
221
222{
223 /* Assume we can only get here if we have already checked the device is kosher */
224
229 mouse_dev *currDev;
230 int devLoop;
231
232 //printf("PS2Mouse_connect devId %d\n", devId);
233
234 dev = sceUsbdScanStaticDescriptor(devId, NULL, USB_DT_DEVICE); /* Get device descriptor */
235 if(!dev)
236 {
237 printf("ERROR: Couldn't get device descriptor\n");
238 return 1;
239 }
240
241 conf = sceUsbdScanStaticDescriptor(devId, dev, USB_DT_CONFIG);
242 if(!conf)
243 {
244 printf("ERROR: Couldn't get configuration descriptor\n");
245 return 1;
246 }
247
248 intf = (UsbInterfaceDescriptor *) ((char *) conf + conf->bLength); /* Get first interface */
249 endp = (UsbEndpointDescriptor *) ((char *) intf + intf->bLength);
250 endp = (UsbEndpointDescriptor *) ((char *) endp + endp->bLength); /* Go to the data endpoint */
251
252 currDev = (mouse_dev *) AllocSysMemory(0, sizeof(mouse_dev), NULL);
253 if(!currDev)
254 {
255 printf("ERROR: Couldn't allocate a device point for the mouse\n");
256 return 1;
257 }
258
259 currDev->configEndp = sceUsbdOpenPipe(devId, NULL);
260 currDev->dataEndp = sceUsbdOpenPipe(devId, endp);
261 currDev->packetSize = endp->wMaxPacketSizeLB | ((int) endp->wMaxPacketSizeHB << 8);
262 if((unsigned int)(currDev->packetSize) > sizeof(mouse_data_recv))
263 {
264 currDev->packetSize = sizeof(mouse_data_recv);
265 }
266
267 currDev->devId = devId;
268
269 if(dev->iManufacturer)
270 {
271 usb_getstring(currDev->configEndp, dev->iManufacturer, "Mouse Manufacturer");
272 }
273
274 if(dev->iProduct)
275 {
276 usb_getstring(currDev->configEndp, dev->iProduct, "Mouse Product");
277 }
278
279 for(devLoop = 0; devLoop < PS2MOUSE_MAXDEV; devLoop++)
280 {
281 if(devices[devLoop] == NULL)
282 {
283 devices[devLoop] = currDev;
284 break;
285 }
286 }
287
288 if(devLoop == PS2MOUSE_MAXDEV)
289 {
290 /* How the f*** did we end up here ??? */
291 printf("ERROR: Device Weirdness!!\n");
292 return 1;
293 }
294
295 sceUsbdSetPrivateData(devId, currDev); /* Set the index for the device data */
296
297 //printf("Configuration value %d\n", conf->bConfigurationValue);
298 sceUsbdSetConfiguration(currDev->configEndp, conf->bConfigurationValue, ps2mouse_config_set, currDev);
299
300 dev_count++; /* Increment device count */
301 printf("PS2MOUSE: Connected device\n");
302
303 return 0;
304}
305
306int ps2mouse_disconnect(int devId)
307
308{
309 int devLoop;
310 //printf("PS2Mouse_disconnect devId %d\n", devId);
311
312 for(devLoop = 0; devLoop < PS2MOUSE_MAXDEV; devLoop++)
313 {
314 if((devices[devLoop]) && (devices[devLoop]->devId == devId))
315 {
316 dev_count--;
317 FreeSysMemory(devices[devLoop]);
318 devices[devLoop] = NULL;
319 printf("PS2MOUSE: Disconnected device\n");
320 break;
321 }
322 }
323
324 return 0;
325}
326
327
328typedef struct _string_descriptor
329
330{
331 u8 buf[200];
332 char *desc;
334
335void ps2mouse_getstring_set(int resultCode, int bytes, void *arg)
336
337{
339 string_descriptor *strBuf = (string_descriptor *) arg;
340
341/* printf("=========getstring=========\n"); */
342
343/* printf("PS2MOUSE: GET_DESCRIPTOR res %d, bytes %d, arg %p\n", resultCode, bytes, arg); */
344
345 if(resultCode == USB_RC_OK)
346 {
347 char string[50];
348 int strLoop;
349
350 memset(string, 0, 50);
351 for(strLoop = 0; strLoop < ((bytes - 2) / 2); strLoop++)
352 {
353 string[strLoop] = str->wData[strLoop] & 0xFF;
354 }
355 printf("%s: %s\n", strBuf->desc, string);
356 }
357
358 FreeSysMemory(arg);
359}
360
361void usb_getstring(int endp, int index, char *desc)
362
363{
364 u8 *data;
366
367 data = (u8 *) AllocSysMemory(0, sizeof(string_descriptor), NULL);
368 str = (string_descriptor *) data;
369
370 if(data != NULL)
371 {
372 int ret;
373
374 str->desc = desc;
375 ret = sceUsbdControlTransfer(endp, 0x80, USB_REQ_GET_DESCRIPTOR, (USB_DT_STRING << 8) | index,
376 0, sizeof(string_descriptor) - 4, data, ps2mouse_getstring_set, data);
377 if(ret != USB_RC_OK)
378 {
379 printf("PS2MOUSE: Error sending string descriptor request\n");
380 FreeSysMemory(data);
381 }
382 }
383}
384
385void ps2mouse_config_set(int resultCode, int bytes, void *arg)
386 /* Called when we have finished choosing our configuration */
387
388{
389 mouse_dev *dev;
390
391 if(resultCode != USB_RC_OK)
392 {
393 printf("PS2MOUSE: Configuration set error res %d, bytes %d, arg %p\n", resultCode, bytes, arg);
394 return;
395 }
396
397 //printf("PS2MOUSE: Configuration set res %d, bytes %d, arg %p\n", resultCode, bytes, arg);
398 /* Do a interrupt data transfer */
399
400 dev = (mouse_dev *) arg;
401 if(dev != NULL)
402 {
403 sceUsbdInterruptTransfer(dev->dataEndp, &dev->data, dev->packetSize, ps2mouse_data_recv, arg);
404 }
405}
406
407void ps2mouse_data_recv(int resultCode, int bytes, void *arg)
408
409{
410 mouse_dev *dev;
411
412 if((resultCode != USB_RC_OK) && (resultCode != USB_RC_DATAOVER))
413 {
414 printf("PS2MOUSE: Data Recv set res %d, bytes %d, arg %p\n", resultCode, bytes, arg);
415 return;
416 }
417
418 //printf("PS2MOUSE: Data Recv set res %d, bytes %d, arg %p\n", resultCode, bytes, arg);
419
420 dev = (mouse_dev *) arg;
421 if(dev != NULL)
422 {
423 int buttonLoop;
424 int buttonData;
425 int mx, my;
426
427 WaitSema(mouse_sema);
428
429 mx = dev->data.x;
430 my = dev->data.y;
431
432 if(ABS(mx) >= mouse_thres)
433 {
434 mx = (mx * mouse_accel) >> 16;
435 }
436
437 if(ABS(my) >= mouse_thres)
438 {
439 my = (my * mouse_accel) >> 16;
440 }
441
442/* if(mx > mouse_thres) mx = mouse_thres; */
443/* else if(mx < (-mouse_thres)) mx = -mouse_thres; */
444
445/* if(my > mouse_thres) my = mouse_thres; */
446/* else if(my < (-mouse_thres)) my = -mouse_thres; */
447
448 mouse.x += mx;
449 mouse.y += my;
450 mouse.wheel += dev->data.wheel;
451 buttonData = 0;
452 for(buttonLoop = 0; buttonLoop < PS2MOUSE_MAXBUTTONS; buttonLoop++)
453 {
454 int currButton = 1 << buttonLoop;
455
456 if( ((mouse.buttons & currButton) == 0) && (dev->data.buttons & currButton))
457 {
459 int usec, sec;
460 int msec;
461
462 GetSystemTime(&t);
463 SysClock2USec(&t, (u32 *)&sec, (u32 *)&usec);
464 msec = (sec * 1000) + (usec / 1000);
465 //printf("%d %d %d\n", msec, sec, usec);
466
467 if(dev->timer[buttonLoop])
468 {
469 if((msec - dev->timer[buttonLoop]) < (u32)mouse_dblclicktime)
470 {
471 //printf("Double click\n");
472 buttonData |= (1 << (buttonLoop + 8));
473 dev->timer[buttonLoop] = 0;
474 }
475 else
476 {
477 dev->timer[buttonLoop] = msec;
478 }
479 }
480 else /* If not set a timer */
481 {
482 dev->timer[buttonLoop] = msec;
483 }
484 }
485 }
486 mouse.buttons = dev->data.buttons | buttonData;
487 if(mouse_readmode == PS2MOUSE_READMODE_ABS)
488 {
489 if(mouse.x < mousex_min) mouse.x = mousex_min;
490 if(mouse.x > mousex_max) mouse.x = mousex_max;
491 if(mouse.y < mousey_min) mouse.y = mousey_min;
492 if(mouse.y > mousey_max) mouse.y = mousey_max;
493 }
494
495 SignalSema(mouse_sema);
496 //printf("X = %d, Y = %d, Wheel = %d, Buttons = %x\n", mouse.x, mouse.y, mouse.wheel, mouse.buttons);
497
498 sceUsbdInterruptTransfer(dev->dataEndp, &dev->data, dev->packetSize, ps2mouse_data_recv, arg);
499 }
500}
501
502int ps2mouse_init()
503
504{
505 iop_sema_t s;
506
507 s.initial = 1;
508 s.max = 1;
509 s.option = 0;
510 s.attr = 0;
511 mouse_sema = CreateSema(&s);
512 if(mouse_sema <= 0)
513 {
514 printf("ERROR: Couldn't create ps2mouse sema\n");
515 return 1;
516 }
517
518 if(sceUsbdRegisterLdd(&mouse_driver) >= 0)
519 {
520 memset(&mouse, 0, sizeof(mouse_data));
521 memset(devices, 0, sizeof(mouse_dev *) * PS2MOUSE_MAXDEV);
522 dev_count = 0;
523 mouse_readmode = PS2MOUSE_READMODE_DIFF;
524 mousex_min = -1000000;
525 mousex_max = 1000000;
526 mousey_min = -1000000;
527 mousey_max = 1000000;
528 mouse_dblclicktime = PS2MOUSE_DEFDBLCLICK;
529 mouse_accel = PS2MOUSE_DEFACCEL;
530 mouse_thres = PS2MOUSE_DEFTHRES;
531
532 return 0;
533 } else {
534 printf("ERROR: Couldn't register ps2mouse driver\n");
535 return 1;
536 }
537}
538
539/* RPC Handlers */
540
541void do_ps2mouse_read(u8 *data, int size)
542
543{
544 (void)size;
545
546 //printf("PS2MOUSE read\n");
547 memcpy(data, &mouse, sizeof(mouse_data));
548
549 //printf("%d %d %d %d\n", mouse.x, mouse.y, mouse.buttons, mouse.wheel);
550 if(mouse_readmode == PS2MOUSE_READMODE_DIFF)
551 {
552 mouse.x = 0;
553 mouse.y = 0;
554 mouse.wheel = 0;
555 mouse.buttons &= 0xFF; /* Clear the double click flags */
556 }
557 else
558 {
559 mouse.wheel = 0;
560 mouse.buttons &= 0xFF;
561 }
562}
563
564void do_ps2mouse_setreadmode(const u32 *data, int size)
565
566{
567 (void)size;
568
569 //printf("PS2MOUSE setreadmode mode %d\n", data[0]);
570 if(data[0] == (u32)mouse_readmode)
571 {
572 return;
573 }
574
575 if((data[0] != PS2MOUSE_READMODE_DIFF) && (data[0] != PS2MOUSE_READMODE_ABS))
576 {
577 printf("ERROR: Invalid readmode\n");
578 return;
579 }
580
581 memset(&mouse, 0, sizeof(mouse_data));
582 mouse_readmode = data[0];
583 if(mouse_readmode == PS2MOUSE_READMODE_ABS)
584 {
585 mouse.x = mousex_min;
586 mouse.y = mousey_min;
587 }
588}
589
590void do_ps2mouse_getreadmode(u32 *data, int size)
591
592{
593 (void)size;
594
595 //printf("PS2MOUSE getreadmode\n");
596 data[0] = mouse_readmode;
597}
598
599void do_ps2mouse_setthres(const u32 *data, int size)
600
601{
602 (void)size;
603
604 //printf("PS2MOUSE setthres %d\n", data[0]);
605 mouse_thres = data[0];
606}
607
608void do_ps2mouse_getthres(u32 *data, int size)
609
610{
611 (void)size;
612
613 //printf("PS2MOUSE getthres\n");
614 data[0] = mouse_thres;
615}
616
617void do_ps2mouse_setaccel(const u32 *data, int size)
618
619{
620 (void)size;
621
622 //printf("PS2MOUSE setsense %d\n", data[0]);
623 mouse_accel = data[0];
624}
625
626void do_ps2mouse_getaccel(u32 *data, int size)
627
628{
629 (void)size;
630
631 //printf("PS2MOUSE getsense\n");
632 data[0] = mouse_accel;
633}
634
635void do_ps2mouse_setboundary(const s32 *data, int size)
636
637{
638 (void)size;
639
640 //printf("PS2MOUSE setboundry %d %d %d %d\n", data[0], data[1], data[2], data[3]);
641 if(data[0] < data[1])
642 {
643 mousex_min = data[0];
644 mousex_max = data[1];
645 }
646
647 if(data[2] < data[3])
648 {
649 mousey_min = data[2];
650 mousey_max = data[3];
651 }
652 if(mouse_readmode == PS2MOUSE_READMODE_ABS)
653 {
654
655 mouse.x = mousex_min;
656 mouse.y = mousey_min;
657 }
658}
659
660void do_ps2mouse_getboundary(s32 *data, int size)
661
662{
663 (void)size;
664
665 //printf("PS2MOUSE getboundry\n");
666 data[0] = mousex_min;
667 data[1] = mousex_max;
668 data[2] = mousey_min;
669 data[3] = mousey_max;
670}
671
672void do_ps2mouse_setposition(const s32 *data, int size)
673
674{
675 (void)size;
676
677 //printf("PS2MOUSE setposition %d %d\n", data[0], data[1]);
678
679 WaitSema(mouse_sema);
680
681 if(data[0] < mousex_min)
682 {
683 mouse.x = mousex_min;
684 }
685 else if(data[0] > mousex_max)
686 {
687 mouse.x = mousex_max;
688 }
689 else
690 {
691 mouse.x = data[0];
692 }
693
694 if(data[1] < mousey_min)
695 {
696 mouse.y = mousey_min;
697 }
698 else if(data[1] > mousey_max)
699 {
700 mouse.y = mousey_max;
701 }
702 else
703 {
704 mouse.y = data[1];
705 }
706 SignalSema(mouse_sema);
707}
708
709void do_ps2mouse_reset()
710
711{
712 //printf("PS2MOUSE reset\n");
713 memset(&mouse, 0, sizeof(mouse_data));
714 if(mouse_readmode == PS2MOUSE_READMODE_ABS) /* If ABS mode then set to lowest boundry */
715 {
716 mouse.x = mousex_min;
717 mouse.y = mousey_min;
718 }
719}
720
721void do_ps2mouse_enum(u32 *data, int size)
722
723{
724 (void)size;
725
726 //printf("PS2MOUSE enum\n");
727 data[0] = dev_count;
728}
729
730void do_ps2mouse_setdblclicktime(const u32 *data, int size)
731
732{
733 (void)size;
734
735 //printf("PS2MOUSE setdblclicktime %d\n", data[0]);
736 mouse_dblclicktime = data[0];
737}
738
739void do_ps2mouse_getdblclicktime(u32 *data, int size)
740
741{
742 (void)size;
743
744 //printf("PS2MOUSE getdblclicktime\n");
745 data[0] = mouse_dblclicktime;
746}
747
748void do_ps2mouse_getversion(u32 *data, int size)
749
750{
751 (void)size;
752
753 //printf("PS2MOUSE getversion\n");
754 data[0] = PS2MOUSE_VERSION;
755}
756
757void *rpcCommandHandler(u32 command, void *buffer, int size)
758
759{
760 switch(command)
761 {
762 case PS2MOUSE_READ: do_ps2mouse_read((u8 *) buffer, size);
763 break;
764 case PS2MOUSE_SETREADMODE: do_ps2mouse_setreadmode((u32 *) buffer, size);
765 break;
766 case PS2MOUSE_GETREADMODE: do_ps2mouse_getreadmode((u32 *) buffer, size);
767 break;
768 case PS2MOUSE_SETTHRES: do_ps2mouse_setthres((u32 *) buffer, size);
769 break;
770 case PS2MOUSE_GETTHRES: do_ps2mouse_getthres((u32 *) buffer, size);
771 break;
772 case PS2MOUSE_SETACCEL: do_ps2mouse_setaccel((u32 *) buffer, size);
773 break;
774 case PS2MOUSE_GETACCEL: do_ps2mouse_getaccel((u32 *) buffer, size);
775 break;
776 case PS2MOUSE_SETBOUNDARY: do_ps2mouse_setboundary((s32 *) buffer, size);
777 break;
778 case PS2MOUSE_GETBOUNDARY: do_ps2mouse_getboundary((s32 *) buffer, size);
779 break;
780 case PS2MOUSE_SETPOSITION: do_ps2mouse_setposition((s32 *) buffer, size);
781 break;
782 case PS2MOUSE_RESET: do_ps2mouse_reset();
783 break;
784 case PS2MOUSE_ENUM: do_ps2mouse_enum((u32 *) buffer, size);
785 break;
786 case PS2MOUSE_SETDBLCLICKTIME: do_ps2mouse_setdblclicktime((u32 *) buffer, size);
787 break;
788 case PS2MOUSE_GETDBLCLICKTIME: do_ps2mouse_getdblclicktime((u32 *) buffer, size);
789 break;
790 case PS2MOUSE_GETVERSION: do_ps2mouse_getversion((u32 *) buffer, size);
791 break;
792 default : printf("Unknown PS2MOUSE command %ld\n", command);
793 break;
794 }
795
796 return buffer;
797}
u32 timer[PS2MOUSE_MAXBUTTONS]
Definition ps2mouse.c:83
mouse_dev * devices[PS2MOUSE_MAXDEV]
Definition ps2mouse.c:100
mouse_data mouse
Definition ps2mouse.c:98
mouse_data_recv data
Definition ps2mouse.c:81
#define USB_RC_DATAOVER
Definition usbd.h:254
#define USB_RC_OK
Definition usbd.h:238