1 /* 2 * Copyright 2008-2010, Haiku, Inc. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Clemens Zeidler (haiku@Clemens-Zeidler.de) 7 */ 8 #ifndef PS2_SYNAPTICS_H 9 #define PS2_SYNAPTICS_H 10 11 12 #include <KernelExport.h> 13 14 #include "packet_buffer.h" 15 #include "ps2_service.h" 16 17 18 #define SYN_TOUCHPAD 0x47 19 // Synaptics modes 20 #define SYN_ABSOLUTE_MODE 0x80 21 // Absolute plus w mode 22 #define SYN_ABSOLUTE_W_MODE 0x81 23 #define SYN_FOUR_BYTE_CHILD (1 << 1) 24 // Low power sleep mode 25 #define SYN_SLEEP_MODE 0x0C 26 // Synaptics Passthrough port 27 #define SYN_CHANGE_MODE 0x14 28 #define SYN_PASSTHROUGH_CMD 0x28 29 30 31 #define SYNAPTICS_HISTORY_SIZE 256 32 33 // no touchpad / left / right button pressed 34 #define IS_SYN_PT_PACKAGE(val) ((val[0] & 0xFC) == 0x84 \ 35 && (val[3] & 0xCC) == 0xc4) 36 37 38 typedef struct { 39 uint8 majorVersion; 40 uint8 minorVersion; 41 42 bool capExtended; 43 bool capMiddleButton; 44 bool capSleep; 45 bool capFourButtons; 46 bool capMultiFinger; 47 bool capPalmDetection; 48 bool capPassThrough; 49 bool capClickPad; 50 51 uint8 nExtendedButtons; 52 uint8 firstExtendedButton; 53 uint8 extendedButtonsState; 54 } touchpad_info; 55 56 57 typedef struct { 58 ps2_dev* dev; 59 60 sem_id synaptics_sem; 61 struct packet_buffer* synaptics_ring_buffer; 62 size_t packet_index; 63 uint8 buffer[PS2_PACKET_SYNAPTICS]; 64 uint8 mode; 65 } synaptics_cookie; 66 67 68 status_t synaptics_pass_through_set_packet_size(ps2_dev *dev, uint8 size); 69 status_t passthrough_command(ps2_dev *dev, uint8 cmd, const uint8 *out, 70 int out_count, uint8 *in, int in_count, bigtime_t timeout); 71 status_t probe_synaptics(ps2_dev *dev); 72 73 status_t synaptics_open(const char *name, uint32 flags, void **_cookie); 74 status_t synaptics_close(void *_cookie); 75 status_t synaptics_freecookie(void *_cookie); 76 status_t synaptics_ioctl(void *_cookie, uint32 op, void *buffer, size_t length); 77 78 int32 synaptics_handle_int(ps2_dev *dev); 79 void synaptics_disconnect(ps2_dev *dev); 80 81 extern device_hooks gSynapticsDeviceHooks; 82 83 #endif // PS2_SYNAPTICS_H 84