From 5c56f3607bbb8130cc3d406134e11cfb52dcefcf Mon Sep 17 00:00:00 2001 From: sonic Date: Fri, 8 Feb 2013 19:15:10 +0000 Subject: [PATCH] Detab git-svn-id: https://svn.aros.org/svn/aros/trunk/AROS@46543 fb15a70f-31f2-0310-bbcc-cdcc74a49acc --- arch/i386-pc/drivers/mouse.hidd/drv_ps2.c | 236 +++++++++++++-------------- arch/i386-pc/drivers/mouse.hidd/drv_serial.c | 26 +-- arch/i386-pc/drivers/mouse.hidd/mouse.h | 150 ++++++++--------- arch/i386-pc/drivers/mouse.hidd/mouseclass.c | 88 +++++----- arch/i386-pc/drivers/mouse.hidd/startup.c | 4 +- 5 files changed, 252 insertions(+), 252 deletions(-) diff --git a/arch/i386-pc/drivers/mouse.hidd/drv_ps2.c b/arch/i386-pc/drivers/mouse.hidd/drv_ps2.c index 1f3cfc0fe7..58a17774b1 100644 --- a/arch/i386-pc/drivers/mouse.hidd/drv_ps2.c +++ b/arch/i386-pc/drivers/mouse.hidd/drv_ps2.c @@ -1,5 +1,5 @@ /* - Copyright © 1995-2010, The AROS Development Team. All rights reserved. + Copyright © 1995-2013, The AROS Development Team. All rights reserved. $Id$ Desc: PS/2 mouse driver. @@ -33,13 +33,13 @@ #ifdef HiddMouseAB #undef HiddMouseAB #endif -#define HiddMouseAB (MSD(cl)->hiddMouseAB) +#define HiddMouseAB (MSD(cl)->hiddMouseAB) /* defines for buttonstate */ -#define LEFT_BUTTON 1 -#define RIGHT_BUTTON 2 -#define MIDDLE_BUTTON 4 +#define LEFT_BUTTON 1 +#define RIGHT_BUTTON 2 +#define MIDDLE_BUTTON 4 /****************************************************************************************/ @@ -92,11 +92,11 @@ unsigned char handle_mouse_event(void) mouse_read_input(); status = mouse_read_status(); - if(!work--) + if(!work--) { - //printf(KERN_ERR "pc_keyb: controller jammed (0x%02X).\n",status); + //printf(KERN_ERR "pc_keyb: controller jammed (0x%02X).\n",status); break; - } + } } return status; } @@ -111,12 +111,12 @@ void mouse_wait(void) do { - unsigned char status = handle_mouse_event(); - if (! (status & KBD_STATUS_IBF)) - return; - - mouse_usleep(1000); - timeout--; + unsigned char status = handle_mouse_event(); + if (! (status & KBD_STATUS_IBF)) + return; + + mouse_usleep(1000); + timeout--; } while (timeout); } @@ -157,19 +157,19 @@ void mouse_write_command_w(int data) mouse_write_command(data); } -#define KBD_NO_DATA (-1) -#define KBD_BAD_DATA (-2) +#define KBD_NO_DATA (-1) +#define KBD_BAD_DATA (-2) int mouse_read_data(void) { - LONG retval = KBD_NO_DATA; - UBYTE status; + LONG retval = KBD_NO_DATA; + UBYTE status; status = mouse_read_status(); if (status & KBD_STATUS_OBF) { - UBYTE data = mouse_read_input(); - + UBYTE data = mouse_read_input(); + retval = data; if (status & (KBD_STATUS_GTO | KBD_STATUS_PERR)) retval = KBD_BAD_DATA; @@ -216,59 +216,59 @@ AROS_INTH1(mouse_ps2int,struct mouse_data *, data) AROS_INTFUNC_INIT struct pHidd_Mouse_Event *e = &data->u.ps2.event; - UWORD buttonstate; - WORD work = 10000; + UWORD buttonstate; + WORD work = 10000; UBYTE info, mousecode, *mouse_data; info = mouse_read_status(); for(; ((info = mouse_read_status()) & KBD_STATUS_OBF) && work; work--) { - if (!(info & KBD_STATUS_MOUSE_OBF)) - { - /* - ** Data from keyboard. Hopefully this gets through to keyboard interrupt - ** if we break out of for loop here :-\ - */ - break; - } - - mousecode = mouse_read_input(); - - if (info & (KBD_STATUS_GTO | KBD_STATUS_PERR)) - { + if (!(info & KBD_STATUS_MOUSE_OBF)) + { + /* + ** Data from keyboard. Hopefully this gets through to keyboard interrupt + ** if we break out of for loop here :-\ + */ + break; + } + + mousecode = mouse_read_input(); + + if (info & (KBD_STATUS_GTO | KBD_STATUS_PERR)) + { /* Ignore errors and messages for keyboard -> eat status/error byte */ - continue; - } + continue; + } - /* Mouse Packet Byte */ + /* Mouse Packet Byte */ - mouse_data = data->u.ps2.mouse_data; + mouse_data = data->u.ps2.mouse_data; data->u.ps2.expected_mouse_acks = 0; mouse_data[data->u.ps2.mouse_collected_bytes] = mousecode; - /* Packet validity check. Bit 3 of first mouse packet byte must be set */ + /* Packet validity check. Bit 3 of first mouse packet byte must be set */ - if ((mouse_data[0] & 8) == 0) - { + if ((mouse_data[0] & 8) == 0) + { data->u.ps2.mouse_collected_bytes = 0; - continue; - } + continue; + } data->u.ps2.mouse_collected_bytes++; - if (data->u.ps2.mouse_collected_bytes != data->u.ps2.mouse_packetsize) - { - /* Mouse Packet not yet complete */ - continue; - } + if (data->u.ps2.mouse_collected_bytes != data->u.ps2.mouse_packetsize) + { + /* Mouse Packet not yet complete */ + continue; + } - /* We have a complete mouse packet :-) */ + /* We have a complete mouse packet :-) */ - data->u.ps2.mouse_collected_bytes = 0; + data->u.ps2.mouse_collected_bytes = 0; - /* + /* * Let's see whether these data can be right... * * D7 D6 D5 D4 D3 D2 D1 D0 @@ -293,59 +293,59 @@ AROS_INTH1(mouse_ps2int,struct mouse_data *, data) e->x = mouse_data[1]; e->y = mouse_data[2]; - if (mouse_data[0] & 0x10) e->x -= 256; - if (mouse_data[0] & 0x20) e->y -= 256; + if (mouse_data[0] & 0x10) e->x -= 256; + if (mouse_data[0] & 0x20) e->y -= 256; - /* dy is reversed! */ - e->y = -(e->y); + /* dy is reversed! */ + e->y = -(e->y); - if (e->x || e->y) - { + if (e->x || e->y) + { e->button = vHidd_Mouse_NoButton; e->type = vHidd_Mouse_Motion; data->mouse_callback(data->callbackdata, e); - } + } buttonstate = mouse_data[0] & 0x07; - if ((buttonstate & LEFT_BUTTON) != (data->buttonstate & LEFT_BUTTON)) - { + if ((buttonstate & LEFT_BUTTON) != (data->buttonstate & LEFT_BUTTON)) + { e->button = vHidd_Mouse_Button1; e->type = (buttonstate & LEFT_BUTTON) ? vHidd_Mouse_Press : vHidd_Mouse_Release; data->mouse_callback(data->callbackdata, e); - } + } - if ((buttonstate & RIGHT_BUTTON) != (data->buttonstate & RIGHT_BUTTON)) - { + if ((buttonstate & RIGHT_BUTTON) != (data->buttonstate & RIGHT_BUTTON)) + { e->button = vHidd_Mouse_Button2; e->type = (buttonstate & RIGHT_BUTTON) ? vHidd_Mouse_Press : vHidd_Mouse_Release; data->mouse_callback(data->callbackdata, e); - } + } - if ((buttonstate & MIDDLE_BUTTON) != (data->buttonstate & MIDDLE_BUTTON)) - { + if ((buttonstate & MIDDLE_BUTTON) != (data->buttonstate & MIDDLE_BUTTON)) + { e->button = vHidd_Mouse_Button3; e->type = (buttonstate & MIDDLE_BUTTON) ? vHidd_Mouse_Press : vHidd_Mouse_Release; data->mouse_callback(data->callbackdata, e); - } + } data->buttonstate = buttonstate; #if INTELLIMOUSE_SUPPORT - /* mouse wheel */ - e->y = (mouse_data[3] & 8) ? (mouse_data[3] & 15) - 16 : (mouse_data[3] & 15); - if (e->y) - { - e->x = 0; - e->type = vHidd_Mouse_WheelMotion; - e->button = vHidd_Mouse_NoButton; - - data->mouse_callback(data->callbackdata, e); - } + /* mouse wheel */ + e->y = (mouse_data[3] & 8) ? (mouse_data[3] & 15) - 16 : (mouse_data[3] & 15); + if (e->y) + { + e->x = 0; + e->type = vHidd_Mouse_WheelMotion; + e->button = vHidd_Mouse_NoButton; + + data->mouse_callback(data->callbackdata, e); + } #endif } /* for(; ((info = mouse_read_status()) & KBD_STATUS_OBF) && work; work--) */ @@ -416,17 +416,17 @@ struct mouse_data *data = OOP_INST_DATA(cl, o); UBYTE ack; /* The following doesn't seem to do anything useful */ - mouse_write(KBD_OUTCMD_DISABLE); - /* switch to remote mode */ - mouse_write(KBD_OUTCMD_SET_REMOTE_MODE); - /* we want data */ - ack = data->u.ps2.expected_mouse_acks+1; - mouse_write(KBD_OUTCMD_READ_DATA); - while (data->u.ps2.expected_mouse_acks>=ack) - mouse_usleep(1000); - /* switch back to stream mode */ - mouse_write(KBD_OUTCMD_SET_STREAM_MODE); - mouse_write(KBD_OUTCMD_ENABLE); + mouse_write(KBD_OUTCMD_DISABLE); + /* switch to remote mode */ + mouse_write(KBD_OUTCMD_SET_REMOTE_MODE); + /* we want data */ + ack = data->u.ps2.expected_mouse_acks+1; + mouse_write(KBD_OUTCMD_READ_DATA); + while (data->u.ps2.expected_mouse_acks>=ack) + mouse_usleep(1000); + /* switch back to stream mode */ + mouse_write(KBD_OUTCMD_SET_STREAM_MODE); + mouse_write(KBD_OUTCMD_ENABLE); #endif } @@ -446,19 +446,19 @@ static int detect_aux() do { - unsigned char status = mouse_read_status(); + unsigned char status = mouse_read_status(); - if (status & KBD_STATUS_OBF) - { - (void) mouse_read_input(); - if (status & KBD_STATUS_MOUSE_OBF) - { - retval = 1; - } - break; - } + if (status & KBD_STATUS_OBF) + { + (void) mouse_read_input(); + if (status & KBD_STATUS_MOUSE_OBF) + { + retval = 1; + } + break; + } - mouse_usleep(1000); + mouse_usleep(1000); } while (--loops); @@ -474,21 +474,21 @@ static int query_mouse(UBYTE *buf, int size, int timeout) do { - UBYTE status = mouse_read_status(); - - if (status & KBD_STATUS_OBF) - { - UBYTE c = mouse_read_input(); - - if ((c != KBD_REPLY_ACK) && (status & KBD_STATUS_MOUSE_OBF)) - { - buf[ret++] = c; - } - } - else - { - mouse_usleep(1000); - } + UBYTE status = mouse_read_status(); + + if (status & KBD_STATUS_OBF) + { + UBYTE c = mouse_read_input(); + + if ((c != KBD_REPLY_ACK) && (status & KBD_STATUS_MOUSE_OBF)) + { + buf[ret++] = c; + } + } + else + { + mouse_usleep(1000); + } } while ((--timeout) && (ret < size)); @@ -537,7 +537,7 @@ int mouse_ps2reset(struct mouse_data *data) * Check for a mouse port. */ if (!detect_aux()) - return 0; + return 0; /* * Unfortunately on my computer these commands cause @@ -564,8 +564,8 @@ int mouse_ps2reset(struct mouse_data *data) #if INTELLIMOUSE_SUPPORT if (detect_intellimouse()) { - data->u.ps2.mouse_protocol = PS2_PROTOCOL_INTELLIMOUSE; - data->u.ps2.mouse_packetsize = 4; + data->u.ps2.mouse_protocol = PS2_PROTOCOL_INTELLIMOUSE; + data->u.ps2.mouse_packetsize = 4; } #endif diff --git a/arch/i386-pc/drivers/mouse.hidd/drv_serial.c b/arch/i386-pc/drivers/mouse.hidd/drv_serial.c index d046498ab7..60ad4a88cf 100644 --- a/arch/i386-pc/drivers/mouse.hidd/drv_serial.c +++ b/arch/i386-pc/drivers/mouse.hidd/drv_serial.c @@ -1,5 +1,5 @@ /* - Copyright © 1995-2010, The AROS Development Team. All rights reserved. + Copyright © 1995-2013, The AROS Development Team. All rights reserved. $Id$ Desc: COM mouse driver. @@ -29,13 +29,13 @@ #include #undef HiddMouseAB -#define HiddMouseAB (MSD(cl)->hiddMouseAB) +#define HiddMouseAB (MSD(cl)->hiddMouseAB) /* defines for buttonstate */ -#define LEFT_BUTTON 1 -#define RIGHT_BUTTON 2 -#define MIDDLE_BUTTON 4 +#define LEFT_BUTTON 1 +#define RIGHT_BUTTON 2 +#define MIDDLE_BUTTON 4 /* Prototypes */ @@ -167,10 +167,10 @@ int test_mouse_serial(OOP_Class *cl, OOP_Object *o) void dispose_mouse_serial(OOP_Class *cl, OOP_Object *o) { struct mouse_data *data = OOP_INST_DATA(cl, o); - HIDD_Serial_DisposeUnit(data->u.ser.serial, data->u.ser.unit); - FreeMem(data->u.ser.rx, sizeof(struct Ring)); - OOP_DisposeObject(data->u.ser.serial); - CloseLibrary(data->u.ser.shidd); + HIDD_Serial_DisposeUnit(data->u.ser.serial, data->u.ser.unit); + FreeMem(data->u.ser.rx, sizeof(struct Ring)); + OOP_DisposeObject(data->u.ser.serial); + CloseLibrary(data->u.ser.shidd); } /******************************************************************/ @@ -531,11 +531,11 @@ int mouse_DetectPNP(struct mouse_data *data, OOP_Object *unit) if(buf[0] == 79) return 1; - /* stegerg: checkme! Added this return -1, because if this is - not there, then below the "return (t->val)" is used to leave - the function, with t pointing to random address */ + /* stegerg: checkme! Added this return -1, because if this is + not there, then below the "return (t->val)" is used to leave + the function, with t pointing to random address */ - return -1; + return -1; } else if(len > 1) { diff --git a/arch/i386-pc/drivers/mouse.hidd/mouse.h b/arch/i386-pc/drivers/mouse.hidd/mouse.h index 88c3943388..8f129e64d1 100644 --- a/arch/i386-pc/drivers/mouse.hidd/mouse.h +++ b/arch/i386-pc/drivers/mouse.hidd/mouse.h @@ -29,16 +29,16 @@ #define RIGHT_BUTTON 2 #define MIDDLE_BUTTON 4 -#define INTELLIMOUSE_SUPPORT 1 +#define INTELLIMOUSE_SUPPORT 1 -#define PS2_PROTOCOL_STANDARD 0 +#define PS2_PROTOCOL_STANDARD 0 #define PS2_PROTOCOL_INTELLIMOUSE 1 /***** Mouse HIDD *******************/ /* IDs */ -#define IID_Hidd_PCmouse "hidd.bus.mouse" -#define CLID_Hidd_PCmouse "hidd.bus.mouse" +#define IID_Hidd_PCmouse "hidd.bus.mouse" +#define CLID_Hidd_PCmouse "hidd.bus.mouse" /* Methods */ enum @@ -51,20 +51,20 @@ struct pHidd_Mouse_HandleEvent OOP_MethodID mID; ULONG event; }; - + VOID Hidd_Mouse_HandleEvent(OOP_Object *o, ULONG event); - + /* misc */ struct mouse_staticdata { struct SignalSemaphore sema; /* Protexting this whole struct */ - OOP_AttrBase hiddMouseAB; + OOP_AttrBase hiddMouseAB; - OOP_Class *mouseclass; + OOP_Class *mouseclass; - OOP_Object *mousehidd; + OOP_Object *mousehidd; }; struct mousebase @@ -105,28 +105,28 @@ struct mouse_data } usb; struct { - struct Interrupt irq; - UBYTE mouse_data[5]; - UBYTE mouse_collected_bytes; - UBYTE mouse_protocol; + struct Interrupt irq; + UBYTE mouse_data[5]; + UBYTE mouse_collected_bytes; + UBYTE mouse_protocol; UBYTE mouse_packetsize; - UBYTE expected_mouse_acks; + UBYTE expected_mouse_acks; UBYTE packetsize; - + struct pHidd_Mouse_Event event; } ps2; struct { - OOP_Object *serial; - OOP_Object *unit; - struct Library *shidd; - UBYTE mouse_data[5]; - UBYTE mouse_collected_bytes; - UBYTE mouse_protocol; - UBYTE mouse_inth_state; - - struct pHidd_Mouse_Event event; - struct Ring *rx; /* Ring structure for mouse init */ + OOP_Object *serial; + OOP_Object *unit; + struct Library *shidd; + UBYTE mouse_data[5]; + UBYTE mouse_collected_bytes; + UBYTE mouse_protocol; + UBYTE mouse_inth_state; + + struct pHidd_Mouse_Event event; + struct Ring *rx; /* Ring structure for mouse init */ } ser; } u; }; @@ -160,55 +160,55 @@ struct mouse_data /****************************************************************************************/ -#define KBD_STATUS_OBF 0x01 /* keyboard output buffer full */ -#define KBD_STATUS_IBF 0x02 /* keyboard input buffer full */ -#define KBD_STATUS_MOUSE_OBF 0x20 /* Mouse output buffer full */ +#define KBD_STATUS_OBF 0x01 /* keyboard output buffer full */ +#define KBD_STATUS_IBF 0x02 /* keyboard input buffer full */ +#define KBD_STATUS_MOUSE_OBF 0x20 /* Mouse output buffer full */ #define KBD_STATUS_GTO 0x40 /* General receive/xmit timeout */ #define KBD_STATUS_PERR 0x80 /* Parity error */ -#define KBD_CTRLCMD_READ_MODE 0x20 -#define KBD_CTRLCMD_WRITE_MODE 0x60 -#define KBD_CTRLCMD_GET_VERSION 0xA1 -#define KBD_CTRLCMD_MOUSE_DISABLE 0xA7 -#define KBD_CTRLCMD_MOUSE_ENABLE 0xA8 -#define KBD_CTRLCMD_TEST_MOUSE 0xA9 -#define KBD_CTRLCMD_SELF_TEST 0xAA -#define KBD_CTRLCMD_KBD_TEST 0xAB -#define KBD_CTRLCMD_KBD_DISABLE 0xAD -#define KBD_CTRLCMD_KBD_ENABLE 0xAE -#define KBD_CTRLCMD_WRITE_AUX_OBUF 0xD3 -#define KBD_CTRLCMD_WRITE_MOUSE 0xD4 - -#define KBD_OUTCMD_SET_RES 0xE8 -#define KBD_OUTCMD_SET_SCALE11 0xE6 -#define KBD_OUTCMD_SET_SCALE21 0xE7 -#define KBD_OUTCMD_STATUS_REQUEST 0xE9 -#define KBD_OUTCMD_SET_STREAM_MODE 0xEA -#define KBD_OUTCMD_READ_DATA 0xEB -#define KBD_OUTCMD_SET_REMOTE_MODE 0xF0 -#define KBD_OUTCMD_GET_ID 0xF2 -#define KBD_OUTCMD_SET_RATE 0xF3 -#define KBD_OUTCMD_SET_STREAM 0xEA -#define KBD_OUTCMD_ENABLE 0xF4 -#define KBD_OUTCMD_DISABLE 0xF5 -#define KBD_OUTCMD_RESET 0xFF - -#define KBD_STATUS_REG 0x64 -#define KBD_CONTROL_REG 0x64 -#define KBD_DATA_REG 0x60 - -#define KBD_REPLY_POR 0xAA /* Power on reset */ -#define KBD_REPLY_ACK 0xFA /* Command ACK */ -#define KBD_REPLY_RESEND 0xFE /* Command NACK, send the cmd again */ - -#define KBD_MODE_KBD_INT 0x01 /* Keyboard data generate IRQ1 */ -#define KBD_MODE_MOUSE_INT 0x02 /* Mouse data generate IRQ12 */ -#define KBD_MODE_SYS 0x04 /* The system flag (?) */ -#define KBD_MODE_NO_KEYLOCK 0x08 /* The keylock doesn't affect the keyboard if set */ -#define KBD_MODE_DISABLE_KBD 0x10 /* Disable keyboard interface */ -#define KBD_MODE_DISABLE_MOUSE 0x20 /* Disable mouse interface */ -#define KBD_MODE_KCC 0x40 /* Scan code conversion to PC format */ -#define KBD_MODE_RFU 0x80 +#define KBD_CTRLCMD_READ_MODE 0x20 +#define KBD_CTRLCMD_WRITE_MODE 0x60 +#define KBD_CTRLCMD_GET_VERSION 0xA1 +#define KBD_CTRLCMD_MOUSE_DISABLE 0xA7 +#define KBD_CTRLCMD_MOUSE_ENABLE 0xA8 +#define KBD_CTRLCMD_TEST_MOUSE 0xA9 +#define KBD_CTRLCMD_SELF_TEST 0xAA +#define KBD_CTRLCMD_KBD_TEST 0xAB +#define KBD_CTRLCMD_KBD_DISABLE 0xAD +#define KBD_CTRLCMD_KBD_ENABLE 0xAE +#define KBD_CTRLCMD_WRITE_AUX_OBUF 0xD3 +#define KBD_CTRLCMD_WRITE_MOUSE 0xD4 + +#define KBD_OUTCMD_SET_RES 0xE8 +#define KBD_OUTCMD_SET_SCALE11 0xE6 +#define KBD_OUTCMD_SET_SCALE21 0xE7 +#define KBD_OUTCMD_STATUS_REQUEST 0xE9 +#define KBD_OUTCMD_SET_STREAM_MODE 0xEA +#define KBD_OUTCMD_READ_DATA 0xEB +#define KBD_OUTCMD_SET_REMOTE_MODE 0xF0 +#define KBD_OUTCMD_GET_ID 0xF2 +#define KBD_OUTCMD_SET_RATE 0xF3 +#define KBD_OUTCMD_SET_STREAM 0xEA +#define KBD_OUTCMD_ENABLE 0xF4 +#define KBD_OUTCMD_DISABLE 0xF5 +#define KBD_OUTCMD_RESET 0xFF + +#define KBD_STATUS_REG 0x64 +#define KBD_CONTROL_REG 0x64 +#define KBD_DATA_REG 0x60 + +#define KBD_REPLY_POR 0xAA /* Power on reset */ +#define KBD_REPLY_ACK 0xFA /* Command ACK */ +#define KBD_REPLY_RESEND 0xFE /* Command NACK, send the cmd again */ + +#define KBD_MODE_KBD_INT 0x01 /* Keyboard data generate IRQ1 */ +#define KBD_MODE_MOUSE_INT 0x02 /* Mouse data generate IRQ12 */ +#define KBD_MODE_SYS 0x04 /* The system flag (?) */ +#define KBD_MODE_NO_KEYLOCK 0x08 /* The keylock doesn't affect the keyboard if set */ +#define KBD_MODE_DISABLE_KBD 0x10 /* Disable keyboard interface */ +#define KBD_MODE_DISABLE_MOUSE 0x20 /* Disable mouse interface */ +#define KBD_MODE_KCC 0x40 /* Scan code conversion to PC format */ +#define KBD_MODE_RFU 0x80 /****************************************************************************************/ @@ -242,10 +242,10 @@ static inline void outb(unsigned char value, unsigned short port) /****************************************************************************************/ -#define mouse_read_input() inb(0x60) //KBD_DATA_REG) -#define mouse_read_status() inb(0x64) //KBD_STATUS_REG) -#define mouse_write_output(val) outb(val, 0x60) //KBD_DATA_REG) -#define mouse_write_command(val) outb(val, 0x64) //KBD_CONTROL_REG) +#define mouse_read_input() inb(0x60) //KBD_DATA_REG) +#define mouse_read_status() inb(0x64) //KBD_STATUS_REG) +#define mouse_write_output(val) outb(val, 0x60) //KBD_DATA_REG) +#define mouse_write_command(val) outb(val, 0x64) //KBD_CONTROL_REG) /****************************************************************************************/ diff --git a/arch/i386-pc/drivers/mouse.hidd/mouseclass.c b/arch/i386-pc/drivers/mouse.hidd/mouseclass.c index 65548c05f8..748fc08a9c 100644 --- a/arch/i386-pc/drivers/mouse.hidd/mouseclass.c +++ b/arch/i386-pc/drivers/mouse.hidd/mouseclass.c @@ -1,5 +1,5 @@ /* - Copyright © 1995-2006, The AROS Development Team. All rights reserved. + Copyright © 1995-2013, The AROS Development Team. All rights reserved. $Id$ Desc: The main mouse class. @@ -45,7 +45,7 @@ #ifdef HiddMouseAB #undef HiddMouseAB #endif -#define HiddMouseAB (MSD(cl)->hiddMouseAB) +#define HiddMouseAB (MSD(cl)->hiddMouseAB) /* Prototypes */ @@ -59,9 +59,9 @@ void getps2State(OOP_Class *, OOP_Object *, struct pHidd_Mouse_Event *); /* defines for buttonstate */ -#define LEFT_BUTTON 1 -#define RIGHT_BUTTON 2 -#define MIDDLE_BUTTON 4 +#define LEFT_BUTTON 1 +#define RIGHT_BUTTON 2 +#define MIDDLE_BUTTON 4 /***** Mouse::New() ***************************************/ OOP_Object * PCMouse__Root__New(OOP_Class *cl, OOP_Object *o, struct pRoot_New *msg) @@ -114,18 +114,18 @@ OOP_Object * PCMouse__Root__New(OOP_Class *cl, OOP_Object *o, struct pRoot_New * first, if not found search for PS/2 mouse. If failure then check every COM port in the system - the last chance to see... */ - data->type = MDT_USB; + data->type = MDT_USB; if (!test_mouse_usb(cl, o)) { - memset(&data->u.ser, 0, sizeof(data->u.ser)); - data->type = MDT_SERIAL; + memset(&data->u.ser, 0, sizeof(data->u.ser)); + data->type = MDT_SERIAL; - if (!test_mouse_serial(cl, o)) - { - memset(&data->u.ps2, 0, sizeof(data->u.ps2)); - data->type = MDT_PS2; + if (!test_mouse_serial(cl, o)) + { + memset(&data->u.ps2, 0, sizeof(data->u.ps2)); + data->type = MDT_PS2; - if (!test_mouse_ps2(cl, o)) + if (!test_mouse_ps2(cl, o)) { /* No mouse found. What we can do now is just Dispose() :( */ OOP_MethodID disp_mid; @@ -156,17 +156,17 @@ VOID PCMouse__Root__Dispose(OOP_Class *cl, OOP_Object *o, OOP_Msg msg) switch (data->type) { - case MDT_USB: - dispose_mouse_usb(cl, o); - break; + case MDT_USB: + dispose_mouse_usb(cl, o); + break; - case MDT_SERIAL: - dispose_mouse_serial(cl, o); - break; + case MDT_SERIAL: + dispose_mouse_serial(cl, o); + break; - case MDT_PS2: - dispose_mouse_ps2(cl, o); - break; + case MDT_PS2: + dispose_mouse_ps2(cl, o); + break; } OOP_DoSuperMethod(cl, o, msg); @@ -176,29 +176,29 @@ VOID PCMouse__Root__Dispose(OOP_Class *cl, OOP_Object *o, OOP_Msg msg) VOID PCMouse__Root__Get(OOP_Class *cl, OOP_Object *o, struct pRoot_Get *msg) { struct mouse_data *data = OOP_INST_DATA(cl, o); - ULONG idx; + ULONG idx; if (IS_HIDDMOUSE_ATTR(msg->attrID, idx)) { - switch (idx) - { - case aoHidd_Mouse_IrqHandler: - *msg->storage = (IPTR)data->mouse_callback; - return; - - case aoHidd_Mouse_IrqHandlerData: - *msg->storage = (IPTR)data->callbackdata; - return; - - case aoHidd_Mouse_State: - if (data->type == MDT_PS2) - getps2State(cl, o, (struct pHidd_Mouse_Event *)msg->storage); - return; - - case aoHidd_Mouse_RelativeCoords: - *msg->storage = TRUE; - return; - } + switch (idx) + { + case aoHidd_Mouse_IrqHandler: + *msg->storage = (IPTR)data->mouse_callback; + return; + + case aoHidd_Mouse_IrqHandlerData: + *msg->storage = (IPTR)data->callbackdata; + return; + + case aoHidd_Mouse_State: + if (data->type == MDT_PS2) + getps2State(cl, o, (struct pHidd_Mouse_Event *)msg->storage); + return; + + case aoHidd_Mouse_RelativeCoords: + *msg->storage = TRUE; + return; + } } @@ -223,7 +223,7 @@ static int PCMouse_InitAttrs(LIBBASETYPEPTR LIBBASE) struct OOP_ABDescr attrbases[] = { { IID_Hidd_Mouse, &LIBBASE->msd.hiddMouseAB }, - { NULL , NULL } + { NULL , NULL } }; EnterFunc(bug("PCMouse_InitAttrs\n")); @@ -237,7 +237,7 @@ static int PCMouse_ExpungeAttrs(LIBBASETYPEPTR LIBBASE) struct OOP_ABDescr attrbases[] = { { IID_Hidd_Mouse, &LIBBASE->msd.hiddMouseAB }, - { NULL , NULL } + { NULL , NULL } }; EnterFunc(bug("PCMouse_InitClass\n")); diff --git a/arch/i386-pc/drivers/mouse.hidd/startup.c b/arch/i386-pc/drivers/mouse.hidd/startup.c index b56ae72aa1..cf626ffde5 100644 --- a/arch/i386-pc/drivers/mouse.hidd/startup.c +++ b/arch/i386-pc/drivers/mouse.hidd/startup.c @@ -12,11 +12,11 @@ static int init_mouse(LIBBASETYPEPTR LIBBASE) ms = OOP_NewObject(NULL, CLID_Hidd_Mouse, NULL); if (ms) { drv = HIDD_Mouse_AddHardwareDriver(ms, LIBBASE->msd.mouseclass, NULL); - OOP_DisposeObject(ms); + OOP_DisposeObject(ms); } if (!drv) - return FALSE; + return FALSE; LIBBASE->library.lib_OpenCnt = 1; return TRUE; -- 2.11.4.GIT