1 #ifndef _SERIAL_MOUSE_ 2 #define _SERIAL_MOUSE_ 3 4 #include <keyboard_mouse_driver.h> 5 6 typedef enum mouse_id { 7 kNoDevice = -2, 8 kUnknown = -1, // Something there, but can't recognize it yet. 9 kNotSet = 0, 10 kMicrosoft, // 3-bytes, 2 and 3 buttons. 11 kLogitech, // (3+1)-bytes, 3-buttons. 12 kMouseSystems, // 5-bytes, 3-buttons. 13 kIntelliMouse // 4-bytes, up to 5 buttons, 1 or 2 wheels. 14 }; 15 16 class BSerialPort; 17 class SerialMouse { 18 public: 19 SerialMouse(); 20 virtual ~SerialMouse(); 21 22 status_t IsMousePresent(); 23 mouse_id MouseID() { return fMouseID; }; 24 const char* MouseDescription(); 25 26 status_t GetMouseEvent(mouse_movement* mm); 27 28 private: 29 mouse_id DetectMouse(); 30 mouse_id ParseID(char buffer[], uint8 length); 31 status_t SetPortOptions(); 32 33 status_t GetPacket(char data[]); 34 status_t PacketToMM(char data[], mouse_movement* mm); 35 36 void DumpData(mouse_movement* mm); 37 38 BSerialPort* fSerialPort; 39 uint8 fPortsCount; 40 uint8 fPortNumber; // The port in use. 41 mouse_id fMouseID; 42 43 uint8 fButtonsState; 44 }; 45 46 #endif // _SERIAL_MOUSE_ 47