Automatic white space cleanup.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28459 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2008-11-02 11:30:41 +00:00
parent b5c3e3f430
commit 03973d27eb
14 changed files with 92 additions and 89 deletions
+2 -2
View File
@@ -20,8 +20,8 @@ extern "C" {
typedef struct { typedef struct {
bus_manager_info binfo; bus_manager_info binfo;
int32 (*function1)(); int32 (*function1)();
int32 (*function2)(); int32 (*function2)();
} ps2_module_info; } ps2_module_info;
@@ -100,17 +100,17 @@ float
sqrtf(float x) sqrtf(float x)
{ {
float z; float z;
int32 sign = (int)0x80000000; int32 sign = (int)0x80000000;
int32 ix,s,q,m,t,i; int32 ix,s,q,m,t,i;
uint32 r; uint32 r;
GET_FLOAT_WORD(ix,x); GET_FLOAT_WORD(ix,x);
/* take care of Inf and NaN */ /* take care of Inf and NaN */
if ((ix&0x7f800000)==0x7f800000) { if ((ix&0x7f800000)==0x7f800000) {
return x*x+x; /* sqrt(NaN)=NaN, sqrt(+inf)=+inf return x*x+x; /* sqrt(NaN)=NaN, sqrt(+inf)=+inf
sqrt(-inf)=sNaN */ sqrt(-inf)=sNaN */
} }
/* take care of zero */ /* take care of zero */
if (ix<=0) { if (ix<=0) {
if ((ix&(~sign))==0) return x;/* sqrt(+-0) = +-0 */ if ((ix&(~sign))==0) return x;/* sqrt(+-0) = +-0 */
@@ -135,12 +135,12 @@ sqrtf(float x)
r = 0x01000000; /* r = moving bit from right to left */ r = 0x01000000; /* r = moving bit from right to left */
while(r!=0) { while(r!=0) {
t = s+r; t = s+r;
if (t<=ix) { if (t<=ix) {
s = t+r; s = t+r;
ix -= t; ix -= t;
q += r; q += r;
} }
ix += ix; ix += ix;
r>>=1; r>>=1;
} }
@@ -163,7 +163,7 @@ sqrtf(float x)
} }
int32 int32
make_small(float value) make_small(float value)
{ {
if (value > 0) if (value > 0)
@@ -173,17 +173,17 @@ make_small(float value)
} }
void void
get_raw_movement(movement_maker *move, uint32 posX, uint32 posY) get_raw_movement(movement_maker *move, uint32 posX, uint32 posY)
{ {
int16 i; int16 i;
float meanXOld = 0, meanYOld = 0; float meanXOld = 0, meanYOld = 0;
float meanX = 0, meanY = 0; float meanX = 0, meanY = 0;
// calculate mean // calculate mean
for (i = 0; i < move->n_points; i++) { for (i = 0; i < move->n_points; i++) {
meanXOld+= move->historyX[i]; meanXOld += move->historyX[i];
meanYOld+= move->historyY[i]; meanYOld += move->historyY[i];
} }
if (move->n_points == 0) { if (move->n_points == 0) {
meanXOld = posX; meanXOld = posX;
@@ -192,10 +192,10 @@ get_raw_movement(movement_maker *move, uint32 posX, uint32 posY)
meanXOld = meanXOld / move->n_points; meanXOld = meanXOld / move->n_points;
meanYOld = meanYOld / move->n_points; meanYOld = meanYOld / move->n_points;
} }
meanX = (meanXOld + posX) / 2; meanX = (meanXOld + posX) / 2;
meanY = (meanYOld + posY) / 2; meanY = (meanYOld + posY) / 2;
// fill history // fill history
for (i = 0; i < HISTORY_SIZE - 1; i++) { for (i = 0; i < HISTORY_SIZE - 1; i++) {
move->historyX[i] = move->historyX[i + 1]; move->historyX[i] = move->historyX[i + 1];
@@ -203,14 +203,14 @@ get_raw_movement(movement_maker *move, uint32 posX, uint32 posY)
} }
move->historyX[HISTORY_SIZE - 1] = meanX; move->historyX[HISTORY_SIZE - 1] = meanX;
move->historyY[HISTORY_SIZE - 1] = meanY; move->historyY[HISTORY_SIZE - 1] = meanY;
if (move->n_points < HISTORY_SIZE) { if (move->n_points < HISTORY_SIZE) {
move->n_points++; move->n_points++;
move->xDelta = 0; move->xDelta = 0;
move->yDelta = 0; move->yDelta = 0;
return; return;
} }
move->xDelta = make_small((meanX - meanXOld) / 16); move->xDelta = make_small((meanX - meanXOld) / 16);
move->yDelta = make_small((meanY - meanYOld) / 16); move->yDelta = make_small((meanY - meanYOld) / 16);
} }
@@ -221,9 +221,9 @@ compute_acceleration(movement_maker *move, int8 accel_factor)
{ {
// acceleration // acceleration
float acceleration = 1; float acceleration = 1;
if (accel_factor) { if (accel_factor != 0) {
acceleration = 1 + sqrtf(move->xDelta * move->xDelta + move->yDelta * move->yDelta) acceleration = 1 + sqrtf(move->xDelta * move->xDelta
* accel_factor / 50.0; + move->yDelta * move->yDelta) * accel_factor / 50.0;
} }
move->xDelta = make_small(move->xDelta * acceleration); move->xDelta = make_small(move->xDelta * acceleration);
@@ -231,7 +231,7 @@ compute_acceleration(movement_maker *move, int8 accel_factor)
} }
void void
get_movement(movement_maker *move, uint32 posX, uint32 posY) get_movement(movement_maker *move, uint32 posX, uint32 posY)
{ {
get_raw_movement(move, posX, posY); get_raw_movement(move, posX, posY);
@@ -244,21 +244,21 @@ void
get_scrolling(movement_maker *move, uint32 posX, uint32 posY) get_scrolling(movement_maker *move, uint32 posX, uint32 posY)
{ {
int32 stepsX = 0, stepsY = 0; int32 stepsX = 0, stepsY = 0;
get_raw_movement(move, posX, posY); get_raw_movement(move, posX, posY);
compute_acceleration(move, move->scroll_acceleration); compute_acceleration(move, move->scroll_acceleration);
move->scrolling_x+= move->xDelta; move->scrolling_x+= move->xDelta;
move->scrolling_y+= move->yDelta; move->scrolling_y+= move->yDelta;
stepsX = make_small(move->scrolling_x / move->scrolling_xStep); stepsX = make_small(move->scrolling_x / move->scrolling_xStep);
stepsY = make_small(move->scrolling_y / move->scrolling_yStep); stepsY = make_small(move->scrolling_y / move->scrolling_yStep);
move->scrolling_x-= stepsX * move->scrolling_xStep; move->scrolling_x-= stepsX * move->scrolling_xStep;
move->scrolling_y-= stepsY * move->scrolling_yStep; move->scrolling_y-= stepsY * move->scrolling_yStep;
move->xDelta = stepsX; move->xDelta = stepsX;
move->yDelta = -1 * stepsY; move->yDelta = -1 * stepsY;
} }
@@ -269,7 +269,7 @@ start_new_movment(movement_maker *move)
move->scrolling_xStep = 1; move->scrolling_xStep = 1;
if (move->scrolling_yStep <= 0) if (move->scrolling_yStep <= 0)
move->scrolling_yStep = 1; move->scrolling_yStep = 1;
move->n_points = 0; move->n_points = 0;
move->scrolling_x = 0; move->scrolling_x = 0;
move->scrolling_y = 0; move->scrolling_y = 0;
@@ -11,20 +11,19 @@ float ceilf(float x);
float sqrtf(float x); float sqrtf(float x);
int32 make_small(float value); int32 make_small(float value);
typedef struct typedef struct {
{
int32 xDelta; int32 xDelta;
int32 yDelta; int32 yDelta;
int8 acceleration; int8 acceleration;
int8 speed; int8 speed;
float scrolling_x; float scrolling_x;
float scrolling_y; float scrolling_y;
int32 scrolling_xStep; int32 scrolling_xStep;
int32 scrolling_yStep; int32 scrolling_yStep;
int32 scroll_acceleration; int32 scroll_acceleration;
uint8 n_points; uint8 n_points;
float historyX[HISTORY_SIZE]; float historyX[HISTORY_SIZE];
float historyY[HISTORY_SIZE]; float historyY[HISTORY_SIZE];
@@ -31,7 +31,8 @@ struct packet_buffer {
struct packet_buffer * struct packet_buffer *
create_packet_buffer(size_t size) create_packet_buffer(size_t size)
{ {
struct packet_buffer *buffer = (packet_buffer *)malloc(sizeof(packet_buffer)); struct packet_buffer *buffer
= (packet_buffer *)malloc(sizeof(packet_buffer));
if (buffer == NULL) if (buffer == NULL)
return NULL; return NULL;
@@ -126,7 +127,8 @@ packet_buffer_read(struct packet_buffer *buffer, uint8 *data, size_t length)
size_t size_t
packet_buffer_write(struct packet_buffer *buffer, const uint8 *data, size_t length) packet_buffer_write(struct packet_buffer *buffer, const uint8 *data,
size_t length)
{ {
cpu_status state = disable_interrupts(); cpu_status state = disable_interrupts();
acquire_spinlock(&buffer->lock); acquire_spinlock(&buffer->lock);
@@ -23,8 +23,10 @@ void packet_buffer_clear(struct packet_buffer *buffer);
size_t packet_buffer_readable(struct packet_buffer *buffer); size_t packet_buffer_readable(struct packet_buffer *buffer);
size_t packet_buffer_writable(struct packet_buffer *buffer); size_t packet_buffer_writable(struct packet_buffer *buffer);
void packet_buffer_flush(struct packet_buffer *buffer, size_t bytes); void packet_buffer_flush(struct packet_buffer *buffer, size_t bytes);
size_t packet_buffer_read(struct packet_buffer *buffer, uint8 *data, size_t length); size_t packet_buffer_read(struct packet_buffer *buffer, uint8 *data, size_t
size_t packet_buffer_write(struct packet_buffer *buffer, const uint8 *data, size_t length); length);
size_t packet_buffer_write(struct packet_buffer *buffer, const uint8 *data,
size_t length);
#ifdef __cplusplus #ifdef __cplusplus
} }
@@ -321,7 +321,7 @@ status_t
ps2_init(void) ps2_init(void)
{ {
status_t status; status_t status;
TRACE("ps2: init\n"); TRACE("ps2: init\n");
status = get_module(B_ISA_MODULE_NAME, (module_info **)&gIsa); status = get_module(B_ISA_MODULE_NAME, (module_info **)&gIsa);
@@ -383,7 +383,7 @@ ps2_init(void)
ps2_service_notify_device_added(&ps2_device[PS2_DEVICE_MOUSE]); ps2_service_notify_device_added(&ps2_device[PS2_DEVICE_MOUSE]);
ps2_service_notify_device_added(&ps2_device[PS2_DEVICE_KEYB]); ps2_service_notify_device_added(&ps2_device[PS2_DEVICE_KEYB]);
} }
TRACE("ps2: init done!\n"); TRACE("ps2: init done!\n");
return B_OK; return B_OK;
@@ -102,7 +102,7 @@ ps2_dev_detect_pointing(ps2_dev *dev, device_hooks **hooks)
// probe devices // probe devices
// the probe function has to set the dev name and the dev packet size // the probe function has to set the dev name and the dev packet size
#if 0 #if 1
status = probe_trackpoint(dev); status = probe_trackpoint(dev);
if (status == B_OK) { if (status == B_OK) {
*hooks = &gStandardMouseDeviceHooks; *hooks = &gStandardMouseDeviceHooks;
@@ -35,7 +35,7 @@ struct ps2_dev {
data_history history[2]; data_history history[2];
ps2_dev * parent_dev; ps2_dev * parent_dev;
size_t packet_size; size_t packet_size;
// functions // functions
void (*disconnect)(ps2_dev *); void (*disconnect)(ps2_dev *);
int32 (*handle_int)(ps2_dev *); int32 (*handle_int)(ps2_dev *);
@@ -60,7 +60,7 @@ static status_t
set_typematic(int32 rate, bigtime_t delay) set_typematic(int32 rate, bigtime_t delay)
{ {
uint8 value; uint8 value;
TRACE("ps2: set_typematic rate %ld, delay %Ld\n", rate, delay); TRACE("ps2: set_typematic rate %ld, delay %Ld\n", rate, delay);
// input server and keyboard preferences *seem* to use a range of 20-300 // input server and keyboard preferences *seem* to use a range of 20-300
@@ -68,22 +68,22 @@ set_typematic(int32 rate, bigtime_t delay)
rate = 20; rate = 20;
if (rate > 300) if (rate > 300)
rate = 300; rate = 300;
// map this into range 0-31 // map this into range 0-31
rate = ((rate - 20) * 31) / (300 - 20); rate = ((rate - 20) * 31) / (300 - 20);
// keyboard uses 0 == fast, 31 == slow // keyboard uses 0 == fast, 31 == slow
value = 31 - rate; value = 31 - rate;
if (delay >= 875000) if (delay >= 875000)
value |= 3 << 5; value |= 3 << 5;
else if (delay >= 625000) else if (delay >= 625000)
value |= 2 << 5; value |= 2 << 5;
else if (delay >= 375000) else if (delay >= 375000)
value |= 1 << 5; value |= 1 << 5;
else else
value |= 0 << 5; value |= 0 << 5;
return ps2_dev_command(&ps2_device[PS2_DEVICE_KEYB], PS2_CMD_KEYBOARD_SET_TYPEMATIC, &value, 1, NULL, 0); return ps2_dev_command(&ps2_device[PS2_DEVICE_KEYB], PS2_CMD_KEYBOARD_SET_TYPEMATIC, &value, 1, NULL, 0);
} }
@@ -103,13 +103,13 @@ keyboard_handle_int(ps2_dev *dev)
sIsExtended = true; sIsExtended = true;
// TRACE("Extended key\n"); // TRACE("Extended key\n");
return B_HANDLED_INTERRUPT; return B_HANDLED_INTERRUPT;
} }
// TRACE("scancode: %x\n", scancode); // TRACE("scancode: %x\n", scancode);
if (scancode & 0x80) { if (scancode & 0x80) {
keyInfo.is_keydown = false; keyInfo.is_keydown = false;
scancode &= 0x7f; scancode &= 0x7f;
} else } else
keyInfo.is_keydown = true; keyInfo.is_keydown = true;
@@ -143,7 +143,7 @@ read_keyboard_packet(at_kbd_io *packet)
status = acquire_sem_etc(sKeyboardSem, 1, B_CAN_INTERRUPT, 0); status = acquire_sem_etc(sKeyboardSem, 1, B_CAN_INTERRUPT, 0);
if (status < B_OK) if (status < B_OK)
return status; return status;
if (!ps2_device[PS2_DEVICE_KEYB].active) { if (!ps2_device[PS2_DEVICE_KEYB].active) {
TRACE("ps2: read_keyboard_packet, Error device no longer active\n"); TRACE("ps2: read_keyboard_packet, Error device no longer active\n");
return B_ERROR; return B_ERROR;
@@ -219,7 +219,7 @@ keyboard_open(const char *name, uint32 flags, void **_cookie)
if (atomic_or(&sKeyboardOpenMask, 1) != 0) if (atomic_or(&sKeyboardOpenMask, 1) != 0)
return B_BUSY; return B_BUSY;
status = probe_keyboard(); status = probe_keyboard();
if (status != B_OK) { if (status != B_OK) {
INFO("ps2: keyboard probing failed\n"); INFO("ps2: keyboard probing failed\n");
@@ -269,7 +269,7 @@ keyboard_close(void *cookie)
delete_sem(sKeyboardSem); delete_sem(sKeyboardSem);
atomic_and(&ps2_device[PS2_DEVICE_KEYB].flags, ~PS2_FLAG_ENABLED); atomic_and(&ps2_device[PS2_DEVICE_KEYB].flags, ~PS2_FLAG_ENABLED);
atomic_and(&sKeyboardOpenMask, 0); atomic_and(&sKeyboardOpenMask, 0);
TRACE("ps2: keyboard_close done\n"); TRACE("ps2: keyboard_close done\n");
@@ -338,7 +338,7 @@ keyboard_ioctl(void *cookie, uint32 op, void *buffer, size_t length)
// 0xF8 (Set All Keys Make/Break) - Keyboard responds with "ack" (0xFA). // 0xF8 (Set All Keys Make/Break) - Keyboard responds with "ack" (0xFA).
return ps2_dev_command(&ps2_device[PS2_DEVICE_KEYB], 0xf8, NULL, 0, NULL, 0); return ps2_dev_command(&ps2_device[PS2_DEVICE_KEYB], 0xf8, NULL, 0, NULL, 0);
} }
case KB_SET_KEY_REPEAT_RATE: case KB_SET_KEY_REPEAT_RATE:
{ {
int32 key_repeat_rate; int32 key_repeat_rate;
@@ -350,7 +350,7 @@ keyboard_ioctl(void *cookie, uint32 op, void *buffer, size_t length)
sKeyboardRepeatRate = key_repeat_rate; sKeyboardRepeatRate = key_repeat_rate;
return B_OK; return B_OK;
} }
case KB_GET_KEY_REPEAT_RATE: case KB_GET_KEY_REPEAT_RATE:
{ {
TRACE("ps2: ioctl KB_GET_KEY_REPEAT_RATE\n"); TRACE("ps2: ioctl KB_GET_KEY_REPEAT_RATE\n");
@@ -367,7 +367,7 @@ keyboard_ioctl(void *cookie, uint32 op, void *buffer, size_t length)
return B_ERROR; return B_ERROR;
sKeyboardRepeatDelay = key_repeat_delay; sKeyboardRepeatDelay = key_repeat_delay;
return B_OK; return B_OK;
} }
case KB_GET_KEY_REPEAT_DELAY: case KB_GET_KEY_REPEAT_DELAY:
@@ -34,31 +34,31 @@ std_ops(int32 op, ...)
case B_MODULE_INIT: case B_MODULE_INIT:
return ps2_init(); return ps2_init();
case B_MODULE_UNINIT: case B_MODULE_UNINIT:
ps2_uninit(); ps2_uninit();
break; break;
default: default:
return B_ERROR; return B_ERROR;
} }
return B_OK; return B_OK;
} }
static ps2_module_info ps2_module = { static ps2_module_info ps2_module = {
.binfo = { .binfo = {
.minfo = { .minfo = {
.name = B_PS2_MODULE_NAME, .name = B_PS2_MODULE_NAME,
.flags = B_KEEP_LOADED, .flags = B_KEEP_LOADED,
.std_ops = std_ops, .std_ops = std_ops,
}, },
.rescan = NULL, .rescan = NULL,
}, },
&function1, &function1,
&function2, &function2,
}; };
module_info *modules[] = { module_info *modules[] = {
(module_info *)&ps2_module, (module_info *)&ps2_module,
NULL NULL
}; };
@@ -42,10 +42,10 @@ ps2_service_notify_device_added(ps2_dev *dev)
ps2_service_cmd cmd; ps2_service_cmd cmd;
TRACE("ps2: ps2_service_notify_device_added %s\n", dev->name); TRACE("ps2: ps2_service_notify_device_added %s\n", dev->name);
cmd.id = PS2_SERVICE_NOTIFY_DEVICE_ADDED; cmd.id = PS2_SERVICE_NOTIFY_DEVICE_ADDED;
cmd.dev = dev; cmd.dev = dev;
packet_buffer_write(sServiceCmdBuffer, (const uint8 *)&cmd, sizeof(cmd)); packet_buffer_write(sServiceCmdBuffer, (const uint8 *)&cmd, sizeof(cmd));
release_sem_etc(sServiceSem, 1, B_DO_NOT_RESCHEDULE); release_sem_etc(sServiceSem, 1, B_DO_NOT_RESCHEDULE);
@@ -59,10 +59,10 @@ ps2_service_notify_device_republish(ps2_dev *dev)
ps2_service_cmd cmd; ps2_service_cmd cmd;
TRACE("ps2: ps2_service_notify_device_republish %s\n", dev->name); TRACE("ps2: ps2_service_notify_device_republish %s\n", dev->name);
cmd.id = PS2_SERVICE_NOTIFY_DEVICE_REPUBLISH; cmd.id = PS2_SERVICE_NOTIFY_DEVICE_REPUBLISH;
cmd.dev = dev; cmd.dev = dev;
packet_buffer_write(sServiceCmdBuffer, (const uint8 *)&cmd, sizeof(cmd)); packet_buffer_write(sServiceCmdBuffer, (const uint8 *)&cmd, sizeof(cmd));
release_sem_etc(sServiceSem, 1, B_DO_NOT_RESCHEDULE); release_sem_etc(sServiceSem, 1, B_DO_NOT_RESCHEDULE);
@@ -79,7 +79,7 @@ ps2_service_notify_device_removed(ps2_dev *dev)
cmd.id = PS2_SERVICE_NOTIFY_DEVICE_REMOVED; cmd.id = PS2_SERVICE_NOTIFY_DEVICE_REMOVED;
cmd.dev = dev; cmd.dev = dev;
packet_buffer_write(sServiceCmdBuffer, (const uint8 *)&cmd, sizeof(cmd)); packet_buffer_write(sServiceCmdBuffer, (const uint8 *)&cmd, sizeof(cmd));
release_sem_etc(sServiceSem, 1, B_DO_NOT_RESCHEDULE); release_sem_etc(sServiceSem, 1, B_DO_NOT_RESCHEDULE);
@@ -115,7 +115,7 @@ ps2_service_thread(void *arg)
snooze(2500000); snooze(2500000);
ps2_dev_publish(cmd.dev); ps2_dev_publish(cmd.dev);
break; break;
case PS2_SERVICE_NOTIFY_DEVICE_REMOVED: case PS2_SERVICE_NOTIFY_DEVICE_REMOVED:
TRACE("ps2: PS2_SERVICE_NOTIFY_DEVICE_REMOVED %s\n", cmd.dev->name); TRACE("ps2: PS2_SERVICE_NOTIFY_DEVICE_REMOVED %s\n", cmd.dev->name);
ps2_dev_unpublish(cmd.dev); ps2_dev_unpublish(cmd.dev);
@@ -139,7 +139,7 @@ static int
ps2_republish(int argc, char **argv) ps2_republish(int argc, char **argv)
{ {
int dev = 4; int dev = 4;
if (argc == 2) if (argc == 2)
dev = strtoul(argv[1], NULL, 0); dev = strtoul(argv[1], NULL, 0);
if (dev < 0 || dev > 4) if (dev < 0 || dev > 4)
dev = 4; dev = 4;
@@ -171,7 +171,7 @@ ps2_service_init(void)
TRACE("ps2: ps2_service_init done\n"); TRACE("ps2: ps2_service_init done\n");
return B_OK; return B_OK;
err3: err3:
delete_sem(sServiceSem); delete_sem(sServiceSem);
err2: err2:
@@ -28,7 +28,7 @@
typedef struct typedef struct
{ {
ps2_dev * dev; ps2_dev * dev;
sem_id standard_mouse_sem; sem_id standard_mouse_sem;
packet_buffer * standard_mouse_buffer; packet_buffer * standard_mouse_buffer;
bigtime_t click_last_time; bigtime_t click_last_time;
@@ -49,11 +49,11 @@ status_t standard_mouse_close(void *_cookie);
status_t standard_mouse_freecookie(void *_cookie); status_t standard_mouse_freecookie(void *_cookie);
status_t standard_mouse_ioctl(void *_cookie, uint32 op, void *buffer, status_t standard_mouse_ioctl(void *_cookie, uint32 op, void *buffer,
size_t length); size_t length);
int32 standard_mouse_handle_int(ps2_dev *dev); int32 standard_mouse_handle_int(ps2_dev *dev);
void standard_mouse_disconnect(ps2_dev *dev); void standard_mouse_disconnect(ps2_dev *dev);
device_hooks gStandardMouseDeviceHooks; device_hooks gStandardMouseDeviceHooks;
#endif /* __PS2_STANDARD_MOUSE_H */ #endif /* __PS2_STANDARD_MOUSE_H */
@@ -11,7 +11,7 @@
#define SYN_TOUCHPAD 0x47 #define SYN_TOUCHPAD 0x47
// Synaptics modes // Synaptics modes
#define SYN_ABSOLUTE_MODE 0x80 #define SYN_ABSOLUTE_MODE 0x80
// Absolute plus w mode // Absolute plus w mode
#define SYN_ABSOLUTE_W_MODE 0x81 #define SYN_ABSOLUTE_W_MODE 0x81
#define SYN_FOUR_BYTE_CHILD (1 << 1) #define SYN_FOUR_BYTE_CHILD (1 << 1)
@@ -25,7 +25,7 @@
// synaptics touchpad proportions // synaptics touchpad proportions
#define SYN_EDGE_MOTION_WIDTH 50 #define SYN_EDGE_MOTION_WIDTH 50
#define SYN_EDGE_MOTION_SPEED 5 #define SYN_EDGE_MOTION_SPEED 5
#define SYN_AREA_OFFSET 40 // increase the touchpad size a little bit #define SYN_AREA_OFFSET 40 // increase the touchpad size a little bit
#define SYN_AREA_START_X (1472 - SYN_AREA_OFFSET) #define SYN_AREA_START_X (1472 - SYN_AREA_OFFSET)
#define SYN_AREA_END_X (5472 + SYN_AREA_OFFSET) #define SYN_AREA_END_X (5472 + SYN_AREA_OFFSET)
#define SYN_AREA_WIDTH_X (SYN_AREA_END_X - SYN_AREA_START_X) #define SYN_AREA_WIDTH_X (SYN_AREA_END_X - SYN_AREA_START_X)
@@ -48,14 +48,14 @@
typedef struct { typedef struct {
uint8 majorVersion; uint8 majorVersion;
uint8 minorVersion; uint8 minorVersion;
bool capExtended; bool capExtended;
bool capSleep; bool capSleep;
bool capFourButtons; bool capFourButtons;
bool capMultiFinger; bool capMultiFinger;
bool capPalmDetection; bool capPalmDetection;
bool capPassThrough; bool capPassThrough;
} touchpad_info; } touchpad_info;
@@ -68,20 +68,20 @@ typedef struct {
bool finger; bool finger;
bool gesture; bool gesture;
// absolut w mode // absolut w mode
uint8 wValue; uint8 wValue;
} touch_event; } touch_event;
typedef struct typedef struct
{ {
ps2_dev * dev; ps2_dev * dev;
sem_id synaptics_sem; sem_id synaptics_sem;
packet_buffer * synaptics_ring_buffer; packet_buffer * synaptics_ring_buffer;
size_t packet_index; size_t packet_index;
uint8 packet_buffer[PS2_PACKET_SYNAPTICS]; uint8 packet_buffer[PS2_PACKET_SYNAPTICS];
uint8 mode; uint8 mode;
movement_maker movement_maker; movement_maker movement_maker;
bool movement_started; bool movement_started;
bool scrolling_started; bool scrolling_started;
@@ -93,7 +93,7 @@ typedef struct
bool tapdrag_started; bool tapdrag_started;
bool valid_edge_motion; bool valid_edge_motion;
bool double_click; bool double_click;
touchpad_settings settings; touchpad_settings settings;
} synaptics_cookie; } synaptics_cookie;
@@ -119,7 +119,7 @@ status_t synaptics_open(const char *name, uint32 flags, void **_cookie);
status_t synaptics_close(void *_cookie); status_t synaptics_close(void *_cookie);
status_t synaptics_freecookie(void *_cookie); status_t synaptics_freecookie(void *_cookie);
status_t synaptics_ioctl(void *_cookie, uint32 op, void *buffer, size_t length); status_t synaptics_ioctl(void *_cookie, uint32 op, void *buffer, size_t length);
int32 synaptics_handle_int(ps2_dev *dev); int32 synaptics_handle_int(ps2_dev *dev);
void synaptics_disconnect(ps2_dev *dev); void synaptics_disconnect(ps2_dev *dev);
@@ -19,14 +19,14 @@ probe_trackpoint(ps2_dev* dev)
TRACE("TRACKPOINT: probe\n"); TRACE("TRACKPOINT: probe\n");
ps2_dev_command(dev, 0xE1, NULL, 0, val, 2); ps2_dev_command(dev, 0xE1, NULL, 0, val, 2);
if (val[0] != 0x01) { if (val[0] != 0x01) {
TRACE("TRACKPOINT: not found\n"); TRACE("TRACKPOINT: not found\n");
return B_ERROR; return B_ERROR;
} }
dev->name = kTrackpointPath[dev->idx]; dev->name = kTrackpointPath[dev->idx];
dev->packet_size = 3; dev->packet_size = 3;
TRACE("TRACKPOINT: version 0x%x found\n", val[1]); TRACE("TRACKPOINT: version 0x%x found\n", val[1]);
return B_OK; return B_OK;
} }