/shark/trunk/drivers/input/keyboard/atkbd.c |
---|
703,7 → 703,7 |
input_register_device(&atkbd->dev); |
//printk(KERN_INFO "input: %s on %s\n", atkbd->name, serio->phys); |
printk(KERN_INFO "input: %s on %s\n", atkbd->name, serio->phys); |
} |
/shark/trunk/drivers/input/serio/serio.c |
---|
1,5 → 1,5 |
/* |
* $Id: serio.c,v 1.1 2004-03-08 18:47:41 giacomo Exp $ |
* $Id: serio.c,v 1.2 2004-03-25 10:37:49 mauro Exp $ |
* |
* Copyright (c) 1999-2001 Vojtech Pavlik |
*/ |
113,9 → 113,10 |
} |
} |
/* |
static int serio_thread(void *nothing) |
{ |
/*lock_kernel(); |
lock_kernel(); |
daemonize("kseriod"); |
allow_signal(SIGTERM); |
129,9 → 130,10 |
printk(KERN_DEBUG "serio: kseriod exiting\n"); |
unlock_kernel(); |
complete_and_exit(&serio_exited, 0);*/ |
complete_and_exit(&serio_exited, 0); |
return 1; |
} |
*/ |
void serio_rescan(struct serio *serio) |
{ |
/shark/trunk/drivers/input/serio/i8042.c |
---|
695,11 → 695,11 |
serio_register_port(port); |
/*printk(KERN_INFO "serio: i8042 %s port at %#lx,%#lx irq %d\n", |
printk(KERN_INFO "serio: i8042 %s port at %#lx,%#lx irq %d\n", |
values->name, |
(unsigned long) I8042_DATA_REG, |
(unsigned long) I8042_COMMAND_REG, |
values->irq);*/ |
values->irq); |
return 0; |
} |
755,7 → 755,7 |
* We need to reset the 8042 back to original mode on system shutdown, |
* because otherwise BIOSes will be confused. |
*/ |
/* |
static int i8042_notify_sys(struct notifier_block *this, unsigned long code, |
void *unused) |
{ |
770,7 → 770,7 |
NULL, |
0 |
}; |
*/ |
static void __init i8042_init_mux_values(struct i8042_values *values, struct serio *port, int index) |
{ |
memcpy(port, &i8042_aux_port, sizeof(struct serio)); |
/shark/trunk/drivers/input/include/drivers/shark_keyb26.h |
---|
19,17 → 19,6 |
* http://shark.sssup.it |
*/ |
/** |
------------ |
CVS : $Id: shark_keyb26.h,v 1.1 2004-03-22 14:48:15 mauro Exp $ |
File: $File$ |
Revision: $Revision: 1.1 $ |
Last update: $Date: 2004-03-22 14:48:15 $ |
------------ |
**/ |
/* |
* Copyright (C) 2000 Giuseppe Lipari |
* |
49,22 → 38,6 |
* |
*/ |
/* Project: HARTIK 3.0 */ |
/* Description: Hard Real TIme Kernel for 8086 compatible */ |
/* Author: Giuseppe Lipari */ |
/* Start date : 19/6/96 */ |
/* CVS $Id: shark_keyb26.h,v 1.1 2004-03-22 14:48:15 mauro Exp $ */ |
/* File: Keyb.H */ |
/* Revision: 1.4b */ |
/* Last update : 22/3/99 */ |
/* (MG) */ |
/* -- added keyb_enable() & keyb_disable() */ |
/* -- changed keyb_init() definition */ |
#ifndef __KEYB_H__ |
#define __KEYB_H__ |
130,6 → 103,11 |
#define keyb_getchar() keyb_getch(BLOCK) |
/* |
* keyboard initialization |
*/ |
/* the KEYB_PARMS structure used by KEYB26_init() */ |
typedef struct keyb_parms { |
TASK_MODEL *tm; |
unsigned char keymap; |
139,16 → 117,17 |
#define KEYB_DEFAULT ((unsigned long)(-1)) /*+ used for default params +*/ |
#define BASE_KEYB {(TASK_MODEL *)KEYB_DEFAULT, \ |
(unsigned char)KEYB_DEFAULT, \ |
(unsigned char)KEYB_DEFAULT, \ |
(void *)KEYB_DEFAULT} |
#define keyb_default_parm(m) (m).tm = (TASK_MODEL *) KEYB_DEFAULT, \ |
(m).keymap = (unsigned char) KEYB_DEFAULT, \ |
(m).ctrlcfunc = (void *) KEYB_DEFAULT |
#define keyb_def_map(s,m) (s).keymap=(m) |
#define keyb_def_ctrlC(s,f) (s).ctrlcfunc=(f) |
#define keyb_def_task(s,m) (s).tm=(TASK_MODEL *)(m) |
#define keyb_def_map(s,m) (s).keymap = (m) |
#define keyb_def_ctrlC(s,f) (s).ctrlcfunc = (f) |
#define keyb_def_task(s,m) (s).tm = (TASK_MODEL *)(m) |
int KEYB26_init(KEYB_PARMS *s); |
int KEYB26_close(void); |
/shark/trunk/drivers/input/include/drivers/shark_mouse26.h |
---|
43,6 → 43,13 |
#ifndef __SHARK_MOUSE26_H__ |
#define __SHARK_MOUSE26_H__ |
#include <kernel/const.h> |
#include <kernel/model.h> |
#ifdef __cplusplus |
extern "C" { |
#endif |
/* mouse buttons constant */ |
#define MOUSE_RBUTT 1 |
#define MOUSE_CBUTT 2 |
51,20 → 58,76 |
/* the mouse event struct */ |
typedef struct { |
int x, y, z; /* mouse position */ |
int dx, dy, dz; /* distance covered by mouse */ |
int buttons; /* buttons flags */ |
int dx, dy, dz; /* distance covered by mouse */ |
unsigned long buttons; /* buttons flags */ |
} MOUSE_EVT; |
/* macros to test mouse buttons */ |
#define isLeftButton(m) ((m).buttons & MOUSE_LBUTT) |
#define isRightButton(m) ((m).buttons & MOUSE_RBUTT) |
#define isCentralButton(m) ((m).buttons & MOUSE_CBUTT) |
#define isLeftButton(b) ((b) & MOUSE_LBUTT) |
#define isRightButton(b) ((b) & MOUSE_RBUTT) |
#define isCentralButton(b) ((b) & MOUSE_CBUTT) |
/* |
* mouse initialization |
*/ |
/* the MOUSE_PARMS structure used by MOUSE26_init() */ |
typedef struct mouse_parms { |
TASK_MODEL *tm; |
int xmin; |
int ymin; |
int xmax; |
int ymax; |
int threshold; |
} MOUSE_PARMS; |
#define MOUSE_DEFAULT (DWORD)-1 |
/* the default values for the MOUSE_PARMS structure */ |
#define BASE_MOUSE {(TASK_MODEL *)MOUSE_DEFAULT, \ |
(int)MOUSE_DEFAULT, \ |
(int)MOUSE_DEFAULT, \ |
(int)MOUSE_DEFAULT, \ |
(int)MOUSE_DEFAULT, \ |
(int)MOUSE_DEFAULT} |
/* to change the MOUSE_PARMS struct */ |
#define mouse_default_parms(s) (s).tm = (TASK_MODEL *)MOUSE_DEFAULT, \ |
(s).xmin = (int)MOUSE_DEFAULT, \ |
(s).xmin = (int)MOUSE_DEFAULT, \ |
(s).xmin = (int)MOUSE_DEFAULT, \ |
(s).xmin = (int)MOUSE_DEFAULT, \ |
(s).xmin = (int)MOUSE_DEFAULT |
#define mouse_def_task(s,m) (s).tm = (TASK_MODEL *)(m) |
#define mouse_def_thresh(s,v) (s).threshold = (v) |
#define mouse_def_xmin(s,v) (s).xmin = (v) |
#define mouse_def_ymin(s,v) (s).ymin = (v) |
#define mouse_def_xmax(s,v) (s).xmax = (v) |
#define mouse_def_ymax(s,v) (s).ymax = (v) |
/* user mouse handler */ |
typedef void (*MOUSE_HANDLER)(MOUSE_EVT*); |
int MOUSE26_init(void); |
int MOUSE26_close(void); |
/* |
* user mouse interface |
*/ |
int MOUSE26_init(MOUSE_PARMS *s); |
int MOUSE26_close(void); |
void mouse_enable(void); |
void mouse_disable(void); |
void mouse_getpos(int *x, int *y, int *z, unsigned long *buttons); |
void mouse_setpos(int x, int y, int z); |
void mouse_getlimit(int *xmin, int *ymin, int *xmax, int *ymax); |
int mouse_setlimit(int xmin, int ymin, int xmax, int ymax); |
int mouse_getthreshold(void); |
int mouse_setthreshold(int t); |
void mouse_hook(MOUSE_HANDLER h); |
#ifdef __cplusplus |
}; |
#endif |
#endif |
/shark/trunk/drivers/input/mouse/synaptics.h |
---|
0,0 → 1,112 |
/* |
* Synaptics TouchPad PS/2 mouse driver |
* |
* This program is free software; you can redistribute it and/or modify it |
* under the terms of the GNU General Public License version 2 as published by |
* the Free Software Foundation. |
*/ |
#ifndef _SYNAPTICS_H |
#define _SYNAPTICS_H |
extern void synaptics_process_byte(struct psmouse *psmouse, struct pt_regs *regs); |
extern int synaptics_init(struct psmouse *psmouse); |
extern int synaptics_pt_init(struct psmouse *psmouse); |
extern void synaptics_disconnect(struct psmouse *psmouse); |
/* synaptics queries */ |
#define SYN_QUE_IDENTIFY 0x00 |
#define SYN_QUE_MODES 0x01 |
#define SYN_QUE_CAPABILITIES 0x02 |
#define SYN_QUE_MODEL 0x03 |
#define SYN_QUE_SERIAL_NUMBER_PREFIX 0x06 |
#define SYN_QUE_SERIAL_NUMBER_SUFFIX 0x07 |
#define SYN_QUE_RESOLUTION 0x08 |
#define SYN_QUE_EXT_CAPAB 0x09 |
/* synatics modes */ |
#define SYN_BIT_ABSOLUTE_MODE (1 << 7) |
#define SYN_BIT_HIGH_RATE (1 << 6) |
#define SYN_BIT_SLEEP_MODE (1 << 3) |
#define SYN_BIT_DISABLE_GESTURE (1 << 2) |
#define SYN_BIT_FOUR_BYTE_CLIENT (1 << 1) |
#define SYN_BIT_W_MODE (1 << 0) |
/* synaptics model ID bits */ |
#define SYN_MODEL_ROT180(m) ((m) & (1 << 23)) |
#define SYN_MODEL_PORTRAIT(m) ((m) & (1 << 22)) |
#define SYN_MODEL_SENSOR(m) (((m) >> 16) & 0x3f) |
#define SYN_MODEL_HARDWARE(m) (((m) >> 9) & 0x7f) |
#define SYN_MODEL_NEWABS(m) ((m) & (1 << 7)) |
#define SYN_MODEL_PEN(m) ((m) & (1 << 6)) |
#define SYN_MODEL_SIMPLIC(m) ((m) & (1 << 5)) |
#define SYN_MODEL_GEOMETRY(m) ((m) & 0x0f) |
/* synaptics capability bits */ |
#define SYN_CAP_EXTENDED(c) ((c) & (1 << 23)) |
#define SYN_CAP_PASS_THROUGH(c) ((c) & (1 << 7)) |
#define SYN_CAP_SLEEP(c) ((c) & (1 << 4)) |
#define SYN_CAP_FOUR_BUTTON(c) ((c) & (1 << 3)) |
#define SYN_CAP_MULTIFINGER(c) ((c) & (1 << 1)) |
#define SYN_CAP_PALMDETECT(c) ((c) & (1 << 0)) |
#define SYN_CAP_VALID(c) ((((c) & 0x00ff00) >> 8) == 0x47) |
#define SYN_EXT_CAP_REQUESTS(c) ((((c) & 0x700000) >> 20) == 1) |
#define SYN_CAP_MULTI_BUTTON_NO(ec) (((ec) & 0x00f000) >> 12) |
/* synaptics modes query bits */ |
#define SYN_MODE_ABSOLUTE(m) ((m) & (1 << 7)) |
#define SYN_MODE_RATE(m) ((m) & (1 << 6)) |
#define SYN_MODE_BAUD_SLEEP(m) ((m) & (1 << 3)) |
#define SYN_MODE_DISABLE_GESTURE(m) ((m) & (1 << 2)) |
#define SYN_MODE_PACKSIZE(m) ((m) & (1 << 1)) |
#define SYN_MODE_WMODE(m) ((m) & (1 << 0)) |
/* synaptics identify query bits */ |
#define SYN_ID_MODEL(i) (((i) >> 4) & 0x0f) |
#define SYN_ID_MAJOR(i) ((i) & 0x0f) |
#define SYN_ID_MINOR(i) (((i) >> 16) & 0xff) |
#define SYN_ID_IS_SYNAPTICS(i) ((((i) >> 8) & 0xff) == 0x47) |
/* synaptics special commands */ |
#define SYN_PS_SET_MODE2 0x14 |
#define SYN_PS_CLIENT_CMD 0x28 |
/* |
* A structure to describe the state of the touchpad hardware (buttons and pad) |
*/ |
struct synaptics_hw_state { |
int x; |
int y; |
int z; |
int w; |
int left; |
int right; |
int up; |
int down; |
int b0; |
int b1; |
int b2; |
int b3; |
int b4; |
int b5; |
int b6; |
int b7; |
}; |
struct synaptics_data { |
/* Data read from the touchpad */ |
unsigned long int model_id; /* Model-ID */ |
unsigned long int capabilities; /* Capabilities */ |
unsigned long int ext_cap; /* Extended Capabilities */ |
unsigned long int identity; /* Identification */ |
/* Data for normal processing */ |
unsigned int out_of_sync; /* # of packets out of sync */ |
int old_w; /* Previous w value */ |
struct serio *ptport; /* pass-through port */ |
}; |
#endif /* _SYNAPTICS_H */ |
/shark/trunk/drivers/input/mouse/psmouse-base.c |
---|
21,7 → 21,7 |
#include <linux/init.h> |
#include <linux/pm.h> |
#include "psmouse.h" |
//#include "synaptics.h" |
#include "synaptics.h" |
#include "logips2pp.h" |
MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>"); |
175,7 → 175,7 |
* The synaptics driver has its own resync logic, |
* so it needs to receive all bytes one at a time. |
*/ |
//!!!synaptics_process_byte(psmouse, regs); |
synaptics_process_byte(psmouse, regs); |
goto out; |
} |
279,7 → 279,7 |
* Try Synaptics TouchPad magic ID |
*/ |
/*param[0] = 0; |
param[0] = 0; |
psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES); |
psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES); |
psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES); |
293,7 → 293,7 |
return PSMOUSE_SYNAPTICS; |
else |
return PSMOUSE_PS2; |
}*/ |
} |
/* |
* Try Genius NetMouse magic init. |
514,8 → 514,11 |
{ |
struct psmouse *psmouse = serio->private; |
/* Added by Nino - Clean de mouse before closing */ |
psmouse_cleanup(serio); |
psmouse->state = PSMOUSE_IGNORE; |
//!!!synaptics_disconnect(psmouse); |
synaptics_disconnect(psmouse); |
input_unregister_device(&psmouse->dev); |
serio_close(serio); |
kfree(psmouse); |
530,7 → 533,7 |
struct psmouse *psmouse = dev->data; |
struct serio_dev *ser_dev = psmouse->serio->dev; |
//!!!synaptics_disconnect(psmouse); |
synaptics_disconnect(psmouse); |
/* We need to reopen the serio port to reinitialize the i8042 controller */ |
serio_close(psmouse->serio); |
539,7 → 542,7 |
/* Probe and re-initialize the mouse */ |
psmouse_probe(psmouse); |
psmouse_initialize(psmouse); |
//!!!synaptics_pt_init(psmouse); |
synaptics_pt_init(psmouse); |
psmouse_activate(psmouse); |
return 0; |
610,7 → 613,7 |
psmouse_initialize(psmouse); |
//!!!synaptics_pt_init(psmouse); |
synaptics_pt_init(psmouse); |
psmouse_activate(psmouse); |
} |
/shark/trunk/drivers/input/mouse/synaptics.c |
---|
0,0 → 1,635 |
/* |
* Synaptics TouchPad PS/2 mouse driver |
* |
* 2003 Dmitry Torokhov <dtor@mail.ru> |
* Added support for pass-through port |
* |
* 2003 Peter Osterlund <petero2@telia.com> |
* Ported to 2.5 input device infrastructure. |
* |
* Copyright (C) 2001 Stefan Gmeiner <riddlebox@freesurf.ch> |
* start merging tpconfig and gpm code to a xfree-input module |
* adding some changes and extensions (ex. 3rd and 4th button) |
* |
* Copyright (c) 1997 C. Scott Ananian <cananian@alumni.priceton.edu> |
* Copyright (c) 1998-2000 Bruce Kalk <kall@compass.com> |
* code for the special synaptics commands (from the tpconfig-source) |
* |
* This program is free software; you can redistribute it and/or modify it |
* under the terms of the GNU General Public License version 2 as published by |
* the Free Software Foundation. |
* |
* Trademarks are the property of their respective owners. |
*/ |
#include <linuxcomp.h> |
#include <linux/module.h> |
#include <linux/input.h> |
#include <linux/serio.h> |
#include "psmouse.h" |
#include "synaptics.h" |
/* |
* The x/y limits are taken from the Synaptics TouchPad interfacing Guide, |
* section 2.3.2, which says that they should be valid regardless of the |
* actual size of the sensor. |
*/ |
#define XMIN_NOMINAL 1472 |
#define XMAX_NOMINAL 5472 |
#define YMIN_NOMINAL 1408 |
#define YMAX_NOMINAL 4448 |
/***************************************************************************** |
* Synaptics communications functions |
****************************************************************************/ |
/* |
* Use the Synaptics extended ps/2 syntax to write a special command byte. |
* special command: 0xE8 rr 0xE8 ss 0xE8 tt 0xE8 uu where (rr*64)+(ss*16)+(tt*4)+uu |
* is the command. A 0xF3 or 0xE9 must follow (see synaptics_send_cmd |
* and synaptics_mode_cmd) |
*/ |
static int synaptics_special_cmd(struct psmouse *psmouse, unsigned char command) |
{ |
int i; |
if (psmouse_command(psmouse, NULL, PSMOUSE_CMD_SETSCALE11)) |
return -1; |
for (i = 6; i >= 0; i -= 2) { |
unsigned char d = (command >> i) & 3; |
if (psmouse_command(psmouse, &d, PSMOUSE_CMD_SETRES)) |
return -1; |
} |
return 0; |
} |
/* |
* Send a command to the synpatics touchpad by special commands |
*/ |
static int synaptics_send_cmd(struct psmouse *psmouse, unsigned char c, unsigned char *param) |
{ |
if (synaptics_special_cmd(psmouse, c)) |
return -1; |
if (psmouse_command(psmouse, param, PSMOUSE_CMD_GETINFO)) |
return -1; |
return 0; |
} |
/* |
* Set the synaptics touchpad mode byte by special commands |
*/ |
static int synaptics_mode_cmd(struct psmouse *psmouse, unsigned char mode) |
{ |
unsigned char param[1]; |
if (synaptics_special_cmd(psmouse, mode)) |
return -1; |
param[0] = SYN_PS_SET_MODE2; |
if (psmouse_command(psmouse, param, PSMOUSE_CMD_SETRATE)) |
return -1; |
return 0; |
} |
static int synaptics_reset(struct psmouse *psmouse) |
{ |
unsigned char r[2]; |
if (psmouse_command(psmouse, r, PSMOUSE_CMD_RESET_BAT)) |
return -1; |
if (r[0] == PSMOUSE_RET_BAT && r[1] == PSMOUSE_RET_ID) |
return 0; |
return -1; |
} |
/* |
* Read the model-id bytes from the touchpad |
* see also SYN_MODEL_* macros |
*/ |
static int synaptics_model_id(struct psmouse *psmouse) |
{ |
struct synaptics_data *priv = psmouse->private; |
unsigned char mi[3]; |
if (synaptics_send_cmd(psmouse, SYN_QUE_MODEL, mi)) |
return -1; |
priv->model_id = (mi[0]<<16) | (mi[1]<<8) | mi[2]; |
return 0; |
} |
/* |
* Read the capability-bits from the touchpad |
* see also the SYN_CAP_* macros |
*/ |
static int synaptics_capability(struct psmouse *psmouse) |
{ |
struct synaptics_data *priv = psmouse->private; |
unsigned char cap[3]; |
if (synaptics_send_cmd(psmouse, SYN_QUE_CAPABILITIES, cap)) |
return -1; |
priv->capabilities = (cap[0]<<16) | (cap[1]<<8) | cap[2]; |
priv->ext_cap = 0; |
if (!SYN_CAP_VALID(priv->capabilities)) |
return -1; |
if (SYN_EXT_CAP_REQUESTS(priv->capabilities)) { |
if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_CAPAB, cap)) { |
printk(KERN_ERR "Synaptics claims to have extended capabilities," |
" but I'm not able to read them."); |
} else |
priv->ext_cap = (cap[0]<<16) | (cap[1]<<8) | cap[2]; |
} |
return 0; |
} |
/* |
* Identify Touchpad |
* See also the SYN_ID_* macros |
*/ |
static int synaptics_identify(struct psmouse *psmouse) |
{ |
struct synaptics_data *priv = psmouse->private; |
unsigned char id[3]; |
if (synaptics_send_cmd(psmouse, SYN_QUE_IDENTIFY, id)) |
return -1; |
priv->identity = (id[0]<<16) | (id[1]<<8) | id[2]; |
if (SYN_ID_IS_SYNAPTICS(priv->identity)) |
return 0; |
return -1; |
} |
static void print_ident(struct synaptics_data *priv) |
{ |
printk(KERN_INFO "Synaptics Touchpad, model: %ld\n", SYN_ID_MODEL(priv->identity)); |
printk(KERN_INFO " Firmware: %ld.%ld\n", SYN_ID_MAJOR(priv->identity), |
SYN_ID_MINOR(priv->identity)); |
if (SYN_MODEL_ROT180(priv->model_id)) |
printk(KERN_INFO " 180 degree mounted touchpad\n"); |
if (SYN_MODEL_PORTRAIT(priv->model_id)) |
printk(KERN_INFO " portrait touchpad\n"); |
printk(KERN_INFO " Sensor: %ld\n", SYN_MODEL_SENSOR(priv->model_id)); |
if (SYN_MODEL_NEWABS(priv->model_id)) |
printk(KERN_INFO " new absolute packet format\n"); |
if (SYN_MODEL_PEN(priv->model_id)) |
printk(KERN_INFO " pen detection\n"); |
if (SYN_CAP_EXTENDED(priv->capabilities)) { |
printk(KERN_INFO " Touchpad has extended capability bits\n"); |
if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) && |
SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) <= 8) |
printk(KERN_INFO " -> %d multi-buttons, i.e. besides standard buttons\n", |
(int)(SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap))); |
else if (SYN_CAP_FOUR_BUTTON(priv->capabilities)) |
printk(KERN_INFO " -> four buttons\n"); |
if (SYN_CAP_MULTIFINGER(priv->capabilities)) |
printk(KERN_INFO " -> multifinger detection\n"); |
if (SYN_CAP_PALMDETECT(priv->capabilities)) |
printk(KERN_INFO " -> palm detection\n"); |
if (SYN_CAP_PASS_THROUGH(priv->capabilities)) |
printk(KERN_INFO " -> pass-through port\n"); |
} |
} |
static int synaptics_query_hardware(struct psmouse *psmouse) |
{ |
struct synaptics_data *priv = psmouse->private; |
int retries = 0; |
int mode; |
while ((retries++ < 3) && synaptics_reset(psmouse)) |
printk(KERN_ERR "synaptics reset failed\n"); |
if (synaptics_identify(psmouse)) |
return -1; |
if (synaptics_model_id(psmouse)) |
return -1; |
if (synaptics_capability(psmouse)) |
return -1; |
mode = SYN_BIT_ABSOLUTE_MODE | SYN_BIT_HIGH_RATE; |
if (SYN_ID_MAJOR(priv->identity) >= 4) |
mode |= SYN_BIT_DISABLE_GESTURE; |
if (SYN_CAP_EXTENDED(priv->capabilities)) |
mode |= SYN_BIT_W_MODE; |
if (synaptics_mode_cmd(psmouse, mode)) |
return -1; |
return 0; |
} |
/***************************************************************************** |
* Synaptics pass-through PS/2 port support |
****************************************************************************/ |
static int synaptics_pt_open(struct serio *port) |
{ |
return 0; |
} |
static void synaptics_pt_close(struct serio *port) |
{ |
} |
static int synaptics_pt_write(struct serio *port, unsigned char c) |
{ |
struct psmouse *parent = port->driver; |
char rate_param = SYN_PS_CLIENT_CMD; /* indicates that we want pass-through port */ |
if (synaptics_special_cmd(parent, c)) |
return -1; |
if (psmouse_command(parent, &rate_param, PSMOUSE_CMD_SETRATE)) |
return -1; |
return 0; |
} |
static inline int synaptics_is_pt_packet(unsigned char *buf) |
{ |
return (buf[0] & 0xFC) == 0x84 && (buf[3] & 0xCC) == 0xC4; |
} |
static void synaptics_pass_pt_packet(struct serio *ptport, unsigned char *packet) |
{ |
struct psmouse *child = ptport->private; |
if (child) { |
if (child->state == PSMOUSE_ACTIVATED) { |
serio_interrupt(ptport, packet[1], 0, NULL); |
serio_interrupt(ptport, packet[4], 0, NULL); |
serio_interrupt(ptport, packet[5], 0, NULL); |
if (child->type >= PSMOUSE_GENPS) |
serio_interrupt(ptport, packet[2], 0, NULL); |
} else if (child->state != PSMOUSE_IGNORE) { |
serio_interrupt(ptport, packet[1], 0, NULL); |
} |
} |
} |
int synaptics_pt_init(struct psmouse *psmouse) |
{ |
struct synaptics_data *priv = psmouse->private; |
struct serio *port; |
struct psmouse *child; |
if (psmouse->type != PSMOUSE_SYNAPTICS) |
return -1; |
if (!SYN_CAP_EXTENDED(priv->capabilities)) |
return -1; |
if (!SYN_CAP_PASS_THROUGH(priv->capabilities)) |
return -1; |
priv->ptport = port = kmalloc(sizeof(struct serio), GFP_KERNEL); |
if (!port) { |
printk(KERN_ERR "synaptics: not enough memory to allocate serio port\n"); |
return -1; |
} |
memset(port, 0, sizeof(struct serio)); |
port->type = SERIO_PS_PSTHRU; |
port->name = "Synaptics pass-through"; |
port->phys = "synaptics-pt/serio0"; |
port->write = synaptics_pt_write; |
port->open = synaptics_pt_open; |
port->close = synaptics_pt_close; |
port->driver = psmouse; |
printk(KERN_INFO "serio: %s port at %s\n", port->name, psmouse->phys); |
serio_register_slave_port(port); |
/* adjust the touchpad to child's choice of protocol */ |
child = port->private; |
if (child && child->type >= PSMOUSE_GENPS) { |
if (synaptics_mode_cmd(psmouse, (SYN_BIT_ABSOLUTE_MODE | |
SYN_BIT_HIGH_RATE | |
SYN_BIT_DISABLE_GESTURE | |
SYN_BIT_FOUR_BYTE_CLIENT | |
SYN_BIT_W_MODE))) |
printk(KERN_INFO "synaptics: failed to enable 4-byte guest protocol\n"); |
} |
return 0; |
} |
/***************************************************************************** |
* Driver initialization/cleanup functions |
****************************************************************************/ |
static inline void set_abs_params(struct input_dev *dev, int axis, int min, int max, int fuzz, int flat) |
{ |
dev->absmin[axis] = min; |
dev->absmax[axis] = max; |
dev->absfuzz[axis] = fuzz; |
dev->absflat[axis] = flat; |
set_bit(axis, dev->absbit); |
} |
static void set_input_params(struct input_dev *dev, struct synaptics_data *priv) |
{ |
set_bit(EV_ABS, dev->evbit); |
set_abs_params(dev, ABS_X, XMIN_NOMINAL, XMAX_NOMINAL, 0, 0); |
set_abs_params(dev, ABS_Y, YMIN_NOMINAL, YMAX_NOMINAL, 0, 0); |
set_abs_params(dev, ABS_PRESSURE, 0, 255, 0, 0); |
set_bit(ABS_TOOL_WIDTH, dev->absbit); |
set_bit(EV_KEY, dev->evbit); |
set_bit(BTN_TOUCH, dev->keybit); |
set_bit(BTN_TOOL_FINGER, dev->keybit); |
set_bit(BTN_TOOL_DOUBLETAP, dev->keybit); |
set_bit(BTN_TOOL_TRIPLETAP, dev->keybit); |
set_bit(BTN_LEFT, dev->keybit); |
set_bit(BTN_RIGHT, dev->keybit); |
set_bit(BTN_FORWARD, dev->keybit); |
set_bit(BTN_BACK, dev->keybit); |
if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap)) { |
switch (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) & ~0x01) { |
default: |
/* |
* if nExtBtn is greater than 8 it should be considered |
* invalid and treated as 0 |
*/ |
break; |
case 8: |
set_bit(BTN_7, dev->keybit); |
set_bit(BTN_6, dev->keybit); |
case 6: |
set_bit(BTN_5, dev->keybit); |
set_bit(BTN_4, dev->keybit); |
case 4: |
set_bit(BTN_3, dev->keybit); |
set_bit(BTN_2, dev->keybit); |
case 2: |
set_bit(BTN_1, dev->keybit); |
set_bit(BTN_0, dev->keybit); |
break; |
} |
} |
clear_bit(EV_REL, dev->evbit); |
clear_bit(REL_X, dev->relbit); |
clear_bit(REL_Y, dev->relbit); |
} |
int synaptics_init(struct psmouse *psmouse) |
{ |
struct synaptics_data *priv; |
#ifndef CONFIG_MOUSE_PS2_SYNAPTICS |
return -1; |
#endif |
psmouse->private = priv = kmalloc(sizeof(struct synaptics_data), GFP_KERNEL); |
if (!priv) |
return -1; |
memset(priv, 0, sizeof(struct synaptics_data)); |
if (synaptics_query_hardware(psmouse)) { |
printk(KERN_ERR "Unable to query/initialize Synaptics hardware.\n"); |
goto init_fail; |
} |
print_ident(priv); |
set_input_params(&psmouse->dev, priv); |
return 0; |
init_fail: |
kfree(priv); |
return -1; |
} |
void synaptics_disconnect(struct psmouse *psmouse) |
{ |
struct synaptics_data *priv = psmouse->private; |
if (psmouse->type == PSMOUSE_SYNAPTICS && priv) { |
synaptics_mode_cmd(psmouse, 0); |
if (priv->ptport) { |
serio_unregister_slave_port(priv->ptport); |
kfree(priv->ptport); |
} |
kfree(priv); |
} |
} |
/***************************************************************************** |
* Functions to interpret the absolute mode packets |
****************************************************************************/ |
static void synaptics_parse_hw_state(unsigned char buf[], struct synaptics_data *priv, struct synaptics_hw_state *hw) |
{ |
hw->up = 0; |
hw->down = 0; |
hw->b0 = 0; |
hw->b1 = 0; |
hw->b2 = 0; |
hw->b3 = 0; |
hw->b4 = 0; |
hw->b5 = 0; |
hw->b6 = 0; |
hw->b7 = 0; |
if (SYN_MODEL_NEWABS(priv->model_id)) { |
hw->x = (((buf[3] & 0x10) << 8) | |
((buf[1] & 0x0f) << 8) | |
buf[4]); |
hw->y = (((buf[3] & 0x20) << 7) | |
((buf[1] & 0xf0) << 4) | |
buf[5]); |
hw->z = buf[2]; |
hw->w = (((buf[0] & 0x30) >> 2) | |
((buf[0] & 0x04) >> 1) | |
((buf[3] & 0x04) >> 2)); |
hw->left = (buf[0] & 0x01) ? 1 : 0; |
hw->right = (buf[0] & 0x02) ? 1 : 0; |
if (SYN_CAP_EXTENDED(priv->capabilities) && |
(SYN_CAP_FOUR_BUTTON(priv->capabilities))) { |
hw->up = ((buf[3] & 0x01)) ? 1 : 0; |
if (hw->left) |
hw->up = !hw->up; |
hw->down = ((buf[3] & 0x02)) ? 1 : 0; |
if (hw->right) |
hw->down = !hw->down; |
} |
if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) && |
((buf[3] & 2) ? !hw->right : hw->right)) { |
switch (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) & ~0x01) { |
default: |
/* |
* if nExtBtn is greater than 8 it should be |
* considered invalid and treated as 0 |
*/ |
break; |
case 8: |
hw->b7 = ((buf[5] & 0x08)) ? 1 : 0; |
hw->b6 = ((buf[4] & 0x08)) ? 1 : 0; |
case 6: |
hw->b5 = ((buf[5] & 0x04)) ? 1 : 0; |
hw->b4 = ((buf[4] & 0x04)) ? 1 : 0; |
case 4: |
hw->b3 = ((buf[5] & 0x02)) ? 1 : 0; |
hw->b2 = ((buf[4] & 0x02)) ? 1 : 0; |
case 2: |
hw->b1 = ((buf[5] & 0x01)) ? 1 : 0; |
hw->b0 = ((buf[4] & 0x01)) ? 1 : 0; |
} |
} |
} else { |
hw->x = (((buf[1] & 0x1f) << 8) | buf[2]); |
hw->y = (((buf[4] & 0x1f) << 8) | buf[5]); |
hw->z = (((buf[0] & 0x30) << 2) | (buf[3] & 0x3F)); |
hw->w = (((buf[1] & 0x80) >> 4) | ((buf[0] & 0x04) >> 1)); |
hw->left = (buf[0] & 0x01) ? 1 : 0; |
hw->right = (buf[0] & 0x02) ? 1 : 0; |
} |
} |
/* |
* called for each full received packet from the touchpad |
*/ |
static void synaptics_process_packet(struct psmouse *psmouse) |
{ |
struct input_dev *dev = &psmouse->dev; |
struct synaptics_data *priv = psmouse->private; |
struct synaptics_hw_state hw; |
int num_fingers; |
int finger_width; |
synaptics_parse_hw_state(psmouse->packet, priv, &hw); |
if (hw.z > 0) { |
num_fingers = 1; |
finger_width = 5; |
if (SYN_CAP_EXTENDED(priv->capabilities)) { |
switch (hw.w) { |
case 0 ... 1: |
if (SYN_CAP_MULTIFINGER(priv->capabilities)) |
num_fingers = hw.w + 2; |
break; |
case 2: |
if (SYN_MODEL_PEN(priv->model_id)) |
; /* Nothing, treat a pen as a single finger */ |
break; |
case 4 ... 15: |
if (SYN_CAP_PALMDETECT(priv->capabilities)) |
finger_width = hw.w; |
break; |
} |
} |
} else { |
num_fingers = 0; |
finger_width = 0; |
} |
/* Post events */ |
if (hw.z > 0) { |
input_report_abs(dev, ABS_X, hw.x); |
input_report_abs(dev, ABS_Y, YMAX_NOMINAL + YMIN_NOMINAL - hw.y); |
} |
input_report_abs(dev, ABS_PRESSURE, hw.z); |
if (hw.z > 30) input_report_key(dev, BTN_TOUCH, 1); |
if (hw.z < 25) input_report_key(dev, BTN_TOUCH, 0); |
input_report_abs(dev, ABS_TOOL_WIDTH, finger_width); |
input_report_key(dev, BTN_TOOL_FINGER, num_fingers == 1); |
input_report_key(dev, BTN_TOOL_DOUBLETAP, num_fingers == 2); |
input_report_key(dev, BTN_TOOL_TRIPLETAP, num_fingers == 3); |
input_report_key(dev, BTN_LEFT, hw.left); |
input_report_key(dev, BTN_RIGHT, hw.right); |
input_report_key(dev, BTN_FORWARD, hw.up); |
input_report_key(dev, BTN_BACK, hw.down); |
if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap)) |
switch(SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) & ~0x01) { |
default: |
/* |
* if nExtBtn is greater than 8 it should be considered |
* invalid and treated as 0 |
*/ |
break; |
case 8: |
input_report_key(dev, BTN_7, hw.b7); |
input_report_key(dev, BTN_6, hw.b6); |
case 6: |
input_report_key(dev, BTN_5, hw.b5); |
input_report_key(dev, BTN_4, hw.b4); |
case 4: |
input_report_key(dev, BTN_3, hw.b3); |
input_report_key(dev, BTN_2, hw.b2); |
case 2: |
input_report_key(dev, BTN_1, hw.b1); |
input_report_key(dev, BTN_0, hw.b0); |
break; |
} |
input_sync(dev); |
} |
void synaptics_process_byte(struct psmouse *psmouse, struct pt_regs *regs) |
{ |
struct input_dev *dev = &psmouse->dev; |
struct synaptics_data *priv = psmouse->private; |
unsigned char data = psmouse->packet[psmouse->pktcnt - 1]; |
int newabs = SYN_MODEL_NEWABS(priv->model_id); |
input_regs(dev, regs); |
switch (psmouse->pktcnt) { |
case 1: |
if (newabs ? ((data & 0xC8) != 0x80) : ((data & 0xC0) != 0xC0)) { |
printk(KERN_WARNING "Synaptics driver lost sync at 1st byte\n"); |
goto bad_sync; |
} |
break; |
case 2: |
if (!newabs && ((data & 0x60) != 0x00)) { |
printk(KERN_WARNING "Synaptics driver lost sync at 2nd byte\n"); |
goto bad_sync; |
} |
break; |
case 4: |
if (newabs ? ((data & 0xC8) != 0xC0) : ((data & 0xC0) != 0x80)) { |
printk(KERN_WARNING "Synaptics driver lost sync at 4th byte\n"); |
goto bad_sync; |
} |
break; |
case 5: |
if (!newabs && ((data & 0x60) != 0x00)) { |
printk(KERN_WARNING "Synaptics driver lost sync at 5th byte\n"); |
goto bad_sync; |
} |
break; |
default: |
if (psmouse->pktcnt < 6) |
break; /* Wait for full packet */ |
if (priv->out_of_sync) { |
priv->out_of_sync = 0; |
printk(KERN_NOTICE "Synaptics driver resynced.\n"); |
} |
if (priv->ptport && synaptics_is_pt_packet(psmouse->packet)) |
synaptics_pass_pt_packet(priv->ptport, psmouse->packet); |
else |
synaptics_process_packet(psmouse); |
psmouse->pktcnt = 0; |
break; |
} |
return; |
bad_sync: |
priv->out_of_sync++; |
psmouse->pktcnt = 0; |
if (psmouse_resetafter > 0 && priv->out_of_sync == psmouse_resetafter) { |
psmouse->state = PSMOUSE_IGNORE; |
serio_rescan(psmouse->serio); |
} |
} |
/shark/trunk/drivers/input/shark/shark_mouse.c |
---|
35,7 → 35,8 |
* |
*/ |
#define __MOUSE_DEBUG__ |
//#define __MOUSE_DEBUG__ |
//#define MOUSE_TASK |
#include <kernel/kern.h> |
50,54 → 51,244 |
extern int mouse_init(void); |
extern void mouse_exit(void); |
/* Functions */ |
extern int mouse_get(int *dx, int *dy, int *dz, unsigned long *buttons); |
extern int input_installed; |
/* Mouse driver currently installed */ |
/* Mouse driver currently installed/actived */ |
static int mouse_installed = FALSE; |
static int mouse_enabled = FALSE; |
/*static short int mouse_lim_x1 = 0; |
static short int mouse_lim_y1 = 0; |
static short int mouse_lim_x2 = 79; |
static short int mouse_lim_y2 = 24; |
static short int mouse_x = 40; |
static short int mouse_x_mick = 0; |
static short int mouse_y = 12; |
static short int mouse_y_mick = 0; |
static short int mouse_buttons = 0; |
static short int mouse_thresholdlim = 5; |
static int mouse_xmin_tick; |
static int mouse_ymin_tick; |
static int mouse_xmax_tick; |
static int mouse_ymax_tick; |
#define MOUSE_DEF_THRESHOLD 10 |
static int mouse_threshold; |
static int mouse_x = 0; |
static int mouse_y = 0; |
static int mouse_x_tick = 0; |
static int mouse_y_tick = 0; |
static int mouse_z = 0; |
static unsigned long mouse_buttons = 0; |
static MOUSE_HANDLER mouse_handler = NULL; |
static MOUSE_HANDLER user_mouse_handler = NULL; |
static int autocursormode=DISABLE; |
#ifdef MOUSE_TASK |
/* mouse task PID */ |
static PID mousepid = NIL; |
#else |
void mouseProc(void); |
#endif |
static PID mouse_pid = NIL;*/ |
/* |
* Start mouseProc Task |
*/ |
void shark_mouse_task(void) |
void shark_mouse_exec(void) |
{ |
//task_activate(mousebpid); |
#ifdef MOUSE_TASK |
task_activate(mousepid); |
#else |
mouseProc(); |
#endif |
} |
#ifdef MOUSE_TASK |
TASK mouseProc(void) |
#else |
void mouseProc(void) |
#endif |
{ |
static MOUSE_EVT ev; |
unsigned long dbuttons; |
int dx, dy, dz; |
int res; |
#ifdef MOUSE_TASK |
while (1) { |
#endif |
if (mouse_enabled) { |
res = mouse_get(&dx, &dy, &dz, &dbuttons); |
if (res >= 0) { |
mouse_x_tick += dx; |
if (mouse_x_tick < mouse_xmin_tick) |
mouse_x_tick = mouse_xmin_tick; |
if (mouse_x_tick > mouse_xmax_tick) |
mouse_x_tick = mouse_xmax_tick; |
mouse_x = (mouse_x_tick + (mouse_threshold/2)) / mouse_threshold; |
ev.x = mouse_x; |
ev.dx = dx; |
mouse_y_tick -= dy; |
if (mouse_y_tick < mouse_ymin_tick) |
mouse_y_tick = mouse_ymin_tick; |
if (mouse_y_tick > mouse_ymax_tick) |
mouse_y_tick = mouse_ymax_tick; |
mouse_y = (mouse_y_tick + (mouse_threshold/2)) / mouse_threshold; |
ev.y = mouse_y; |
ev.dy = dy; |
mouse_z += dz; |
ev.z = mouse_z; |
ev.dz = dz; |
mouse_buttons = dbuttons; |
ev.buttons = mouse_buttons; |
#ifdef __MOUSE_DEBUG__ |
printk(KERN_DEBUG "shark_mouse.c: delta ( %3d %3d %3d - %6x) -> ( %3d %3d %3d - %6x)\n", |
dx, dy, dz, (int)dbuttons, mouse_x, mouse_y, mouse_z, (int)mouse_buttons); |
#endif |
/* mouse handler */ |
if (mouse_handler!=NULL) mouse_handler(&ev); |
} |
} |
#ifdef MOUSE_TASK |
task_endcycle(); |
} |
#endif |
} |
/**** Start User Functions ****/ |
void mouse_enable(void) |
{ |
mouse_enabled = TRUE; /* TODO */ |
} |
void mouse_disable(void) |
{ |
mouse_enabled = FALSE; /* TODO */ |
} |
void mouse_getpos(int *x,int *y,int *z, unsigned long *buttons) |
{ |
*x = mouse_x; |
*y = mouse_y; |
*z = mouse_z; |
*buttons = mouse_buttons; |
} |
void mouse_setpos(int x,int y, int z) |
{ |
mouse_enabled = FALSE; |
mouse_x = x; |
if (x < (mouse_xmin_tick / mouse_threshold)) |
mouse_x = mouse_xmin_tick / mouse_threshold; |
if (x > (mouse_xmax_tick / mouse_threshold)) |
mouse_x = mouse_xmax_tick / mouse_threshold; |
mouse_y = y; |
if (y < (mouse_ymin_tick / mouse_threshold)) |
mouse_y = mouse_ymin_tick / mouse_threshold; |
if (y > (mouse_ymax_tick / mouse_threshold)) |
mouse_y = mouse_ymax_tick / mouse_threshold; |
mouse_z = z; |
mouse_enabled = TRUE; |
} |
void mouse_getlimit(int *xmin, int *ymin, int *xmax, int *ymax) |
{ |
*xmin = mouse_xmin_tick / mouse_threshold; |
*ymin = mouse_ymin_tick / mouse_threshold; |
*xmax = mouse_xmax_tick / mouse_threshold; |
*ymax = mouse_ymax_tick / mouse_threshold; |
} |
int mouse_setlimit(int xmin, int ymin, int xmax, int ymax) |
{ |
if ((xmin < 0) && (ymin < 0) && (xmax < xmin) && (ymax < ymin)) |
return -1; |
mouse_xmin_tick = xmin * mouse_threshold; |
mouse_ymin_tick = ymin * mouse_threshold; |
mouse_xmax_tick = xmax * mouse_threshold; |
mouse_ymax_tick = ymax * mouse_threshold; |
return 0; |
} |
void mouse_hook(MOUSE_HANDLER h) |
{ |
mouse_handler = h; |
} |
int mouse_getthreshold(void) |
{ |
return mouse_threshold; |
} |
int mouse_setthreshold(int t) |
{ |
mouse_enabled = FALSE; |
if ((t>0) && (t<=200)) { |
mouse_xmin_tick = (mouse_xmin_tick * t) / mouse_threshold; |
mouse_ymin_tick = (mouse_ymin_tick * t) / mouse_threshold; |
mouse_xmax_tick = (mouse_xmax_tick * t) / mouse_threshold; |
mouse_ymax_tick = (mouse_ymax_tick * t) / mouse_threshold; |
mouse_threshold = t; |
return 0; |
} else { |
return -1; |
} |
mouse_enabled = TRUE; |
} |
/**** End User Functions ****/ |
/* Init the Linux Speaker Driver */ |
/*int MOUSE26_init(MOUSE_PARMS *s)*/ |
int MOUSE26_init(void) |
int MOUSE26_init(MOUSE_PARMS *s) |
{ |
/*MOUSE_PARMS mparms=BASE_MOUSE; |
TASK_MODEL *m; |
SOFT_TASK_MODEL base_m;*/ |
MOUSE_PARMS mparms = BASE_MOUSE; |
int status = 0; |
#ifdef MOUSE_TASK |
TASK_MODEL *m; |
SOFT_TASK_MODEL base_m; |
#endif |
if (mouse_installed == TRUE) return 0; |
/* if a NULL is passed */ |
/*if (s == NULL) |
if (s == NULL) |
s = &mparms; |
/* set mouse threshold */ |
if (s->threshold == (int) MOUSE_DEFAULT) |
mouse_threshold = MOUSE_DEF_THRESHOLD; |
else |
mouse_threshold = s->threshold; |
/* set mouse limits */ |
if ((s->xmin == (int) MOUSE_DEFAULT) || (s->xmin < 0)) |
mouse_xmin_tick = 0; |
else |
mouse_xmin_tick = s->xmin * mouse_threshold; |
if ((s->ymin == (int) MOUSE_DEFAULT) || (s->ymin < 0)) |
mouse_ymin_tick = 0; |
else |
mouse_ymin_tick = s->ymin * mouse_threshold; |
if ((s->xmax == (int) MOUSE_DEFAULT) || ((s->xmax * mouse_threshold) < mouse_xmin_tick)) |
mouse_xmax_tick = 79 * mouse_threshold; |
else |
mouse_xmax_tick = s->xmax * mouse_threshold; |
if ((s->ymax == (int) MOUSE_DEFAULT) || ((s->ymax * mouse_threshold) < mouse_ymin_tick)) |
mouse_ymax_tick = 24 * mouse_threshold; |
else |
mouse_ymax_tick = s->ymax * mouse_threshold; |
#ifdef MOUSE_TASK |
if (s->tm == (TASK_MODEL *)MOUSE_DEFAULT) { |
soft_task_default_model(base_m); |
soft_task_def_wcet(base_m,2000); |
108,11 → 299,18 |
soft_task_def_aperiodic(base_m); |
m = (TASK_MODEL *)&base_m; |
} else |
m = parms->tm;*/ |
m = s->tm; |
mousepid = task_create ("MouseTask", mouseProc, m, NULL); |
if (mousepid == -1) { |
return -1; |
} |
#endif |
if (input_installed == FALSE) { |
status = INPUT26_init(); |
if (status) { |
printk(KERN_ERR "shark_mouse.c: Unable to open Input SubSystem.\n"); |
return -1; |
} |
131,6 → 329,7 |
} |
mouse_installed = TRUE; |
mouse_enabled = TRUE; |
return status; |
} |
137,12 → 336,29 |
int MOUSE26_close() |
{ |
#ifdef MOUSE_TASK |
int free; |
SYS_FLAGS f; |
#endif |
if (!mouse_installed) |
return -1; |
mouse_enabled = FALSE; |
mouse_exit(); |
psmouse_exit(); |
#ifdef MOUSE_TASK |
f = kern_fsave(); |
free = (proc_table[mousepid].status == FREE); |
kern_frestore(f); |
#ifdef __MOUSE_DEBUG__ |
printk(KERN_DEBUG "shark_mouse.c: MouseTask is %s.\n", free ? "killed" : "alive"); |
#endif |
if (free) |
task_kill (mousepid); |
#endif |
mouse_installed = FALSE; |
return 0; |
/shark/trunk/drivers/input/shark/shark_keyb.c |
---|
39,7 → 39,7 |
*/ |
//#define __KEYB_DEBUG__ |
//#define KEYB_TASK |
#define KEYB_TASK |
#include <kernel/kern.h> |
#include <signal.h> |
56,10 → 56,9 |
extern int kbd_init(void); |
extern int kbd_exit(void); |
/* Functions */ |
extern int kbd_enable(void); |
extern int kbd_disable(void); |
/* Functions */ |
extern int kbd_get(unsigned int *data, BYTE access); |
extern void kbd_setleds(unsigned int led); |
extern int kbd_rate(unsigned int *delay, unsigned int *period); |
113,7 → 112,7 |
/* keyboard task PID */ |
static PID keybpid; |
#else |
void keyProc(void); |
static void keyProc(void); |
#endif |
/* |
330,7 → 329,7 |
#ifdef KEYB_TASK |
TASK keyProc(void) |
#else |
void keyProc(void) |
static void keyProc(void) |
#endif |
{ |
WORD code; |
360,14 → 359,18 |
#endif |
found = FALSE; |
for (i = 0; i < lastExc; i++) |
if ((keyExcTable[i].evt.scan == dt.scan) && (keyExcTable[i].evt.flag == dt.flag) && (keyExcTable[i].evt.status == dt.status)) { |
if ((keyExcTable[i].evt.scan == dt.scan) && |
(keyExcTable[i].evt.flag == dt.flag) && |
(keyExcTable[i].evt.status == dt.status)) { |
#ifdef __KEYB_DEBUG__ |
printk("shark_keyb.c: Key_Hook ( %2x - %2x - %1d) -> ( %2x - %2x - %1d)\n", dt.scan, dt.flag, dt.status, keyExcTable[i].evt.scan, keyExcTable[i].evt.flag, keyExcTable[i].evt.status); |
printk("shark_keyb.c: Key_Hook ( %2x - %2x - %1d) -> ( %2x - %2x - %1d)\n", |
dt.scan, dt.flag, dt.status, |
keyExcTable[i].evt.scan, keyExcTable[i].evt.flag, keyExcTable[i].evt.status); |
#endif |
keyExcTable[i].func(&dt); |
if (keyExcTable[i].lock == TRUE) |
found = TRUE; |
} |
} |
/* when the port is full, data is lost */ |
if (!found) |
port_send(pkeyPort, (BYTE *) (&dt), NON_BLOCK); |
383,9 → 386,8 |
void default_ctrlChandler(KEY_EVT * k) { |
set_active_page(0); |
set_visual_page(0); |
cputs("Ctrl-C pressed!\n"); |
//cputs("Ctrl-C pressed!\n"); |
sys_end(); |
//exit(1); |
} |
/**** Start User Functions ****/ |
393,13 → 395,19 |
/* Function that returns the ascii code */ |
BYTE keyb_getch(BYTE wait) |
{ |
KEY_EVT c; |
KEY_EVT ev; |
BYTE fl; |
fl = port_receive (ukeyPort, &c, wait); |
if (fl && !isScanCode(c) && !isReleased(c)) |
return (c.ascii); |
else |
fl = port_receive (ukeyPort, &ev, wait); |
if (fl) { |
#ifdef __KEYB_DEBUG__ |
printk("shark_keyb.c: GetChar ( %2x - %c - %2x - %1d)\n", ev.scan, ev.ascii, ev.flag, ev.status); |
#endif |
if (!isScanCode(ev) && !isReleased(ev)) |
return (ev.ascii); |
else |
return 0; |
} else |
return 0; |
} |
423,7 → 431,7 |
return; |
} |
/* MG: this function disable the keyboard */ |
/* This function disable the keyboard */ |
int keyb_disable(void) |
{ |
kbd_disable(); |
430,7 → 438,7 |
return 0; |
} |
/* MG: this function enable the keyboard */ |
/* This function enable the keyboard */ |
int keyb_enable(void) |
{ |
kbd_enable(); |
437,7 → 445,7 |
return 0; |
} |
/**** End Functions ****/ |
/**** End User Functions ****/ |
int KEYB26_init(KEYB_PARMS *s) |
{ |
466,11 → 474,10 |
if (s->keymap == (unsigned char)KEYB_DEFAULT) s->keymap = KEYMAP_US; |
keyb_set_map(s->keymap); |
/* MG: changed RECEIVE to STREAM port - added a failure test */ |
pkeyPort = port_create ("KeybPort", 3, 20, STREAM, WRITE); |
pkeyPort = port_create ("KeybPort", sizeof(KEY_EVT), 20, STREAM, WRITE); |
if (pkeyPort == -1) |
return -2; |
ukeyPort = port_connect ("KeybPort", 3, STREAM, READ); |
ukeyPort = port_connect ("KeybPort", sizeof(KEY_EVT), STREAM, READ); |
if (ukeyPort == -1) { |
port_delete (pkeyPort); |
return -3; |
484,11 → 491,12 |
s->ctrlcfunc = (void *) default_ctrlChandler; |
if (s->ctrlcfunc != NULL) { |
KEY_EVT emerg; |
emerg.ascii = 'c'; |
emerg.scan = KEY_C; |
emerg.flag = CNTL_BIT; |
emerg.ascii = 'c'; |
emerg.scan = KEY_C; |
emerg.status = KEY_PRESSED; |
emerg.flag = CNTL_BIT; |
keyb_hook (emerg, s->ctrlcfunc, TRUE); |
emerg.flag = CNTR_BIT; |
emerg.flag = CNTR_BIT; |
keyb_hook (emerg, s->ctrlcfunc, TRUE); |
} |
520,31 → 528,28 |
if (input_installed == FALSE) |
if (INPUT26_init()) { |
#ifdef __KEYB_DEBUG__ |
printk(KERN_ERR "shark_keyb.c: Unable to open Input SubSystem.\n"); |
#endif |
port_delete (pkeyPort); |
port_delete (ukeyPort); |
task_kill (keybpid); |
return -1; |
} |
status = atkbd_init(); |
if (status) { |
#ifdef __KEYB_DEBUG__ |
printk(KERN_ERR "shark_keyb.c: AtKbd_Init return: %d\n", status); |
#endif |
port_delete (pkeyPort); |
port_delete (ukeyPort); |
task_kill (keybpid); |
return -1; |
} |
status = kbd_init(); |
if (status) { |
#ifdef __KEYB_DEBUG__ |
printk(KERN_ERR "shark_keyb.c: Kbd_Init return: %d\n", status); |
#endif |
port_delete (pkeyPort); |
port_delete (ukeyPort); |
task_kill (keybpid); |
return -1; |
} |
/shark/trunk/drivers/input/misc/pcspkr.c |
---|
82,7 → 82,7 |
input_register_device(&pcspkr_dev); |
//printk(KERN_INFO "input: %s\n", pcspkr_name); |
printk(KERN_INFO "input: %s\n", pcspkr_name); |
return 0; |
} |
/shark/trunk/drivers/input/handler/mouse.c |
---|
1,5 → 1,5 |
/* |
* $Id: mouse.c,v 1.1 2004-03-22 14:48:15 mauro Exp $ |
* $Id: mouse.c,v 1.2 2004-03-25 10:37:48 mauro Exp $ |
* |
* Copyright (c) 1999-2001 Vojtech Pavlik |
*/ |
28,13 → 28,13 |
#include <linux/init.h> |
#include <linux/device.h> |
#define DEBUG_MOUSE |
//#define DEBUG_MOUSE |
MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>"); |
MODULE_DESCRIPTION("Input driver event debug module"); |
MODULE_LICENSE("GPL"); |
extern void shark_mouse_task(void); |
extern void shark_mouse_exec(void); |
#ifndef CONFIG_INPUT_MOUSEDEV_SCREEN_X |
#define CONFIG_INPUT_MOUSEDEV_SCREEN_X 1024 |
94,9 → 94,13 |
*dx = mbuffer[mtail].dx; |
*dy = mbuffer[mtail].dy; |
*dz = mbuffer[mtail].dx; |
*dz = mbuffer[mtail].dz; |
*buttons = mbuffer[mtail].buttons; |
#ifdef DEBUG_MOUSE |
printk(KERN_DEBUG "mouse.c: ( %3d %3d %3d - %6x)\n", mbuffer[mtail].dx, mbuffer[mtail].dy, mbuffer[mtail].dz, (int)mbuffer[mtail].buttons); |
printk(KERN_DEBUG "mouse.c: ( %3d %3d %3d - %6x)\n", *dx, *dy, *dz, *(int *)buttons); |
#endif |
return 0; |
} |
206,9 → 210,9 |
mbuffer[mhead].dy = list->dy; |
mbuffer[mhead].dz = list->dz; |
mhead = (mhead+1) & MOUSE_BUFFERMASK; |
list->dx = list->dx = list->dx = 0; |
list->dx = list->dy = list->dz = 0; |
} |
shark_mouse_task(); |
shark_mouse_exec(); |
break; |
} |
} |
246,11 → 250,6 |
kfree(handle); |
} |
/*static struct input_device_id mouse_ids[] = { |
{ .driver_info = 1 }, // Matches all devices |
{ }, // Terminating zero entry |
};*/ |
static struct input_device_id mouse_ids[] = { |
{ |
.flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_KEYBIT | INPUT_DEVICE_ID_MATCH_RELBIT, |
291,6 → 290,10 |
int __init mouse_init(void) |
{ |
/* Initialize Buffer Variables */ |
mhead=1; |
mtail=0; |
input_register_handler(&mouse_handler); |
return 0; |
} |
/shark/trunk/drivers/input/makefile |
---|
1,4 → 1,4 |
# PCI support from linux 2.6.0 |
# Input support from linux 2.6.0 |
ifndef BASE |
BASE=../.. |
11,7 → 11,7 |
OBJS_PATH = $(BASE)/drivers/input |
OBJS = input.o serio/serio.o serio/i8042.o\ |
mouse/psmouse-base.o mouse/logips2pp.o\ |
mouse/psmouse-base.o mouse/logips2pp.o mouse/synaptics.o\ |
keyboard/atkbd.o\ |
misc/pcspkr.o\ |
handler/evbug.o handler/keyboard.o\ |