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 20// Synaptics modes (values of the "mode" field in synaptics_cookie) 21#define SYN_MODE_ABSOLUTE (1 << 7) 22 // Absolute mode reports the absolute X/Y position of the finger, 23 // instead of relative X/Y movement 24 25#define SYN_MODE_W (1 << 0) 26 // Adds finger width (W) value in addition to absolute X/Y 27#define SYN_MODE_EXTENDED_W (1 << 2) 28 // Supports tracking for multiple fingers 29#define SYN_FOUR_BYTE_CHILD (1 << 1) 30 // Guest packets size for pass-through device 31#define SYN_MODE_SLEEP (1 << 3) 32 // Low power sleep mode 33#define SYN_MODE_PASSTHROUGH_ACPI (1 << 4) 34#define SYN_MODE_PASSTHROUGH_TRANSPARENT (1 << 5) 35#define SYN_MODE_HIGH_RATE (1 << 6) 36 // Use 80 packets per second instead of 40 37 38// Synaptics Passthrough port 39#define SYN_CHANGE_MODE 0x14 40#define SYN_PASSTHROUGH_CMD 0x28 41 42 43#define SYNAPTICS_HISTORY_SIZE 256 44 45// no touchpad / left / right button pressed 46#define IS_SYN_PT_PACKAGE(val) ((val[0] & 0xFC) == 0x84 \ 47 && (val[3] & 0xCC) == 0xc4) 48 49 50typedef struct { 51 ps2_dev* dev; 52 53 sem_id synaptics_sem; 54struct packet_buffer* synaptics_ring_buffer; 55 size_t packet_index; 56 uint8 buffer[PS2_PACKET_SYNAPTICS]; 57 uint8 mode; 58} synaptics_cookie; 59 60 61status_t synaptics_pass_through_set_packet_size(ps2_dev *dev, uint8 size); 62status_t passthrough_command(ps2_dev *dev, uint8 cmd, const uint8 *out, 63 int out_count, uint8 *in, int in_count, bigtime_t timeout); 64status_t probe_synaptics(ps2_dev *dev); 65 66status_t synaptics_open(const char *name, uint32 flags, void **_cookie); 67status_t synaptics_close(void *_cookie); 68status_t synaptics_freecookie(void *_cookie); 69status_t synaptics_ioctl(void *_cookie, uint32 op, void *buffer, size_t length); 70 71int32 synaptics_handle_int(ps2_dev *dev); 72void synaptics_disconnect(ps2_dev *dev); 73 74extern device_hooks gSynapticsDeviceHooks; 75 76#endif // PS2_SYNAPTICS_H 77