Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 547 → Rev 548

/shark/trunk/drivers/input/shark/shark_mouse.c
151,10 → 151,14
 
void mouse_getpos(int *x,int *y,int *z, unsigned long *buttons)
{
*x = mouse_x;
*y = mouse_y;
*z = mouse_z;
*buttons = mouse_buttons;
if (x)
*x = mouse_x;
if (y)
*y = mouse_y;
if (z)
*z = mouse_z;
if (buttons)
*buttons = mouse_buttons;
}
 
void mouse_setpos(int x,int y, int z)
180,10 → 184,14
 
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;
if (xmin)
*xmin = mouse_xmin_tick / mouse_threshold;
if (ymin)
*ymin = mouse_ymin_tick / mouse_threshold;
if (xmax)
*xmax = mouse_xmax_tick / mouse_threshold;
if (ymax)
*ymax = mouse_ymax_tick / mouse_threshold;
}
 
int mouse_setlimit(int xmin, int ymin, int xmax, int ymax)
/shark/trunk/drivers/input/shark/shark_joy.c
16,7 → 16,7
* http://shark.sssup.it
*/
 
#define __JOY_DEBUG__
//#define __JOY_DEBUG__
//#define __JOY_DUMP__
 
#include <kernel/kern.h>
41,8 → 41,6
extern int joystick_exit(void);
 
/* Functions */
extern int joystick_enable(void);
extern int joystick_disable(void);
extern int joystick_get(int *type, int *number, int *value);
 
extern int input_installed;
53,39 → 51,80
 
/* joystick driver currently installed */
static int joystick_installed = FALSE;
static int joystick_enabled = FALSE;
 
static int axis[4], button;
 
/* Called by handler */
void shark_joy_exec(void) {
int type, number, value;
 
if (joystick_enabled == FALSE)
return;
 
if (joystick_get(&type, &number, &value))
return;
 
switch (type) {
switch (type) { /* TODO */
case JS_EVENT_BUTTON:
button = number; /* TODO */
if (value)
button |= 1 << number;
else
button &= ~(1 << number);
break;
case JS_EVENT_AXIS:
axis[number] = value; /* TODO */
axis[number] = value;
break;
default:
return;
}
#ifdef __JOY_DEBUG__
printk(KERN_DEBUG "shark_joy.c: (%4d,%4d) (%4d,%4d) %4d\n", axis[0], axis[1], axis[2], axis[3], button);
printk(KERN_DEBUG "shark_joy.c: (%4d,%4d) (%4d,%4d) %4x\n", axis[0], axis[1], axis[2], axis[3], button);
#endif
}
 
/* User Functions */
void joy_getstatus(int *axe0, int *axe1, int *axe2, int *axe3, int *buttons)
{
if (axe0)
*axe0 = axis[0];
if (axe1)
*axe1 = axis[1];
if (axe2)
*axe2 = axis[2];
if (axe3)
*axe3 = axis[3];
if (buttons)
*buttons = button;
}
 
void joy_setstatus(int axe0, int axe1, int axe2, int axe3, int buttons)
{
if ((axe0 > -32767) && (axe0 < 32767))
axis[0] = axe0;
if ((axe1 > -32767) && (axe1 < 32767))
axis[1] = axe1;
if ((axe2 > -32767) && (axe2 < 32767))
axis[2] = axe2;
if ((axe3 > -32767) && (axe3 < 32767))
axis[3] = axe3;
button = buttons;
}
 
void joy_enable(void)
{
joystick_enable();
joystick_enabled = TRUE;
#ifdef __JOY_DEBUG__
printk("shark_joy.c: Joystick Enabled.\n");
#endif
}
 
void joy_disable(void)
{
joystick_disable();
joystick_enabled = FALSE;
#ifdef __JOY_DEBUG__
printk("shark_joy.c: Joystick Disabled.\n");
#endif
}
 
 
121,9 → 160,10
printk(KERN_ERR "Joystick_Handler_Init return: %d\n", ret);
return -1;
}
joy_enable();
 
joystick_installed = TRUE;
joystick_enabled = TRUE;
 
return 0;
}
 
131,7 → 171,7
if (!joystick_installed)
return -1;
 
joy_disable();
joystick_enabled = FALSE;
joystick_exit();
#ifdef __JOY_DUMP__
joydump_exit();