Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 10553
b: refs/heads/master
c: 2e5b636
h: refs/heads/master
i:
  10551: e3a67ac
v: v3
  • Loading branch information
Dmitry Torokhov authored and Greg Kroah-Hartman committed Oct 28, 2005
1 parent 6461dd5 commit a30003e
Show file tree
Hide file tree
Showing 16 changed files with 364 additions and 362 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d19fbe8a763634395d4bef40fc88cdb61c4a6274
refs/heads/master: 2e5b636bb5f8dacbb91d08544e2c41ebcad5dace
63 changes: 33 additions & 30 deletions trunk/drivers/input/mouse/alps.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ static void alps_process_packet(struct psmouse *psmouse, struct pt_regs *regs)
{
struct alps_data *priv = psmouse->private;
unsigned char *packet = psmouse->packet;
struct input_dev *dev = &psmouse->dev;
struct input_dev *dev2 = &priv->dev2;
struct input_dev *dev = psmouse->dev;
struct input_dev *dev2 = priv->dev2;
int x, y, z, ges, fin, left, right, middle;
int back = 0, forward = 0;

Expand Down Expand Up @@ -379,20 +379,24 @@ static int alps_reconnect(struct psmouse *psmouse)
static void alps_disconnect(struct psmouse *psmouse)
{
struct alps_data *priv = psmouse->private;

psmouse_reset(psmouse);
input_unregister_device(&priv->dev2);
input_unregister_device(priv->dev2);
kfree(priv);
}

int alps_init(struct psmouse *psmouse)
{
struct alps_data *priv;
struct input_dev *dev1 = psmouse->dev, *dev2;
int version;

psmouse->private = priv = kmalloc(sizeof(struct alps_data), GFP_KERNEL);
if (!priv)
psmouse->private = priv = kzalloc(sizeof(struct alps_data), GFP_KERNEL);
dev2 = input_allocate_device();
if (!priv || !dev2)
goto init_fail;
memset(priv, 0, sizeof(struct alps_data));

priv->dev2 = dev2;

if (!(priv->i = alps_get_model(psmouse, &version)))
goto init_fail;
Expand All @@ -411,41 +415,39 @@ int alps_init(struct psmouse *psmouse)
if ((priv->i->flags & ALPS_PASS) && alps_passthrough_mode(psmouse, 0))
goto init_fail;

psmouse->dev.evbit[LONG(EV_KEY)] |= BIT(EV_KEY);
psmouse->dev.keybit[LONG(BTN_TOUCH)] |= BIT(BTN_TOUCH);
psmouse->dev.keybit[LONG(BTN_TOOL_FINGER)] |= BIT(BTN_TOOL_FINGER);
psmouse->dev.keybit[LONG(BTN_LEFT)] |= BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT);
dev1->evbit[LONG(EV_KEY)] |= BIT(EV_KEY);
dev1->keybit[LONG(BTN_TOUCH)] |= BIT(BTN_TOUCH);
dev1->keybit[LONG(BTN_TOOL_FINGER)] |= BIT(BTN_TOOL_FINGER);
dev1->keybit[LONG(BTN_LEFT)] |= BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT);

psmouse->dev.evbit[LONG(EV_ABS)] |= BIT(EV_ABS);
input_set_abs_params(&psmouse->dev, ABS_X, 0, 1023, 0, 0);
input_set_abs_params(&psmouse->dev, ABS_Y, 0, 767, 0, 0);
input_set_abs_params(&psmouse->dev, ABS_PRESSURE, 0, 127, 0, 0);
dev1->evbit[LONG(EV_ABS)] |= BIT(EV_ABS);
input_set_abs_params(dev1, ABS_X, 0, 1023, 0, 0);
input_set_abs_params(dev1, ABS_Y, 0, 767, 0, 0);
input_set_abs_params(dev1, ABS_PRESSURE, 0, 127, 0, 0);

if (priv->i->flags & ALPS_WHEEL) {
psmouse->dev.evbit[LONG(EV_REL)] |= BIT(EV_REL);
psmouse->dev.relbit[LONG(REL_WHEEL)] |= BIT(REL_WHEEL);
dev1->evbit[LONG(EV_REL)] |= BIT(EV_REL);
dev1->relbit[LONG(REL_WHEEL)] |= BIT(REL_WHEEL);
}

if (priv->i->flags & (ALPS_FW_BK_1 | ALPS_FW_BK_2)) {
psmouse->dev.keybit[LONG(BTN_FORWARD)] |= BIT(BTN_FORWARD);
psmouse->dev.keybit[LONG(BTN_BACK)] |= BIT(BTN_BACK);
dev1->keybit[LONG(BTN_FORWARD)] |= BIT(BTN_FORWARD);
dev1->keybit[LONG(BTN_BACK)] |= BIT(BTN_BACK);
}

sprintf(priv->phys, "%s/input1", psmouse->ps2dev.serio->phys);
priv->dev2.phys = priv->phys;
priv->dev2.name = (priv->i->flags & ALPS_DUALPOINT) ? "DualPoint Stick" : "PS/2 Mouse";
priv->dev2.id.bustype = BUS_I8042;
priv->dev2.id.vendor = 0x0002;
priv->dev2.id.product = PSMOUSE_ALPS;
priv->dev2.id.version = 0x0000;

priv->dev2.evbit[0] = BIT(EV_KEY) | BIT(EV_REL);
priv->dev2.relbit[LONG(REL_X)] |= BIT(REL_X) | BIT(REL_Y);
priv->dev2.keybit[LONG(BTN_LEFT)] |= BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT);
dev2->phys = priv->phys;
dev2->name = (priv->i->flags & ALPS_DUALPOINT) ? "DualPoint Stick" : "PS/2 Mouse";
dev2->id.bustype = BUS_I8042;
dev2->id.vendor = 0x0002;
dev2->id.product = PSMOUSE_ALPS;
dev2->id.version = 0x0000;

input_register_device(&priv->dev2);
dev2->evbit[0] = BIT(EV_KEY) | BIT(EV_REL);
dev2->relbit[LONG(REL_X)] |= BIT(REL_X) | BIT(REL_Y);
dev2->keybit[LONG(BTN_LEFT)] |= BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT);

printk(KERN_INFO "input: %s on %s\n", priv->dev2.name, psmouse->ps2dev.serio->phys);
input_register_device(priv->dev2);

psmouse->protocol_handler = alps_process_byte;
psmouse->disconnect = alps_disconnect;
Expand All @@ -455,6 +457,7 @@ int alps_init(struct psmouse *psmouse)
return 0;

init_fail:
input_free_device(dev2);
kfree(priv);
return -1;
}
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/input/mouse/alps.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ struct alps_model_info {
};

struct alps_data {
struct input_dev dev2; /* Relative device */
struct input_dev *dev2; /* Relative device */
char name[32]; /* Name */
char phys[32]; /* Phys */
struct alps_model_info *i; /* Info */
Expand Down
49 changes: 24 additions & 25 deletions trunk/drivers/input/mouse/amimouse.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@ MODULE_DESCRIPTION("Amiga mouse driver");
MODULE_LICENSE("GPL");

static int amimouse_lastx, amimouse_lasty;
static struct input_dev amimouse_dev;

static char *amimouse_name = "Amiga mouse";
static char *amimouse_phys = "amimouse/input0";
static struct input_dev *amimouse_dev;

static irqreturn_t amimouse_interrupt(int irq, void *dummy, struct pt_regs *fp)
{
Expand All @@ -62,16 +59,16 @@ static irqreturn_t amimouse_interrupt(int irq, void *dummy, struct pt_regs *fp)

potgor = custom.potgor;

input_regs(&amimouse_dev, fp);
input_regs(amimouse_dev, fp);

input_report_rel(&amimouse_dev, REL_X, dx);
input_report_rel(&amimouse_dev, REL_Y, dy);
input_report_rel(amimouse_dev, REL_X, dx);
input_report_rel(amimouse_dev, REL_Y, dy);

input_report_key(&amimouse_dev, BTN_LEFT, ciaa.pra & 0x40);
input_report_key(&amimouse_dev, BTN_MIDDLE, potgor & 0x0100);
input_report_key(&amimouse_dev, BTN_RIGHT, potgor & 0x0400);
input_report_key(amimouse_dev, BTN_LEFT, ciaa.pra & 0x40);
input_report_key(amimouse_dev, BTN_MIDDLE, potgor & 0x0100);
input_report_key(amimouse_dev, BTN_RIGHT, potgor & 0x0400);

input_sync(&amimouse_dev);
input_sync(amimouse_dev);

return IRQ_HANDLED;
}
Expand Down Expand Up @@ -103,28 +100,30 @@ static int __init amimouse_init(void)
if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(AMI_MOUSE))
return -ENODEV;

amimouse_dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REL);
amimouse_dev.relbit[0] = BIT(REL_X) | BIT(REL_Y);
amimouse_dev.keybit[LONG(BTN_LEFT)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT);
amimouse_dev.open = amimouse_open;
amimouse_dev.close = amimouse_close;
if (!(amimouse_dev = input_allocate_device()))
return -ENOMEM;

amimouse_dev->name = "Amiga mouse";
amimouse_dev->phys = "amimouse/input0";
amimouse_dev->id.bustype = BUS_AMIGA;
amimouse_dev->id.vendor = 0x0001;
amimouse_dev->id.product = 0x0002;
amimouse_dev->id.version = 0x0100;

amimouse_dev.name = amimouse_name;
amimouse_dev.phys = amimouse_phys;
amimouse_dev.id.bustype = BUS_AMIGA;
amimouse_dev.id.vendor = 0x0001;
amimouse_dev.id.product = 0x0002;
amimouse_dev.id.version = 0x0100;
amimouse_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL);
amimouse_dev->relbit[0] = BIT(REL_X) | BIT(REL_Y);
amimouse_dev->keybit[LONG(BTN_LEFT)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT);
amimouse_dev->open = amimouse_open;
amimouse_dev->close = amimouse_close;

input_register_device(&amimouse_dev);
input_register_device(amimouse_dev);

printk(KERN_INFO "input: %s at joy0dat\n", amimouse_name);
return 0;
}

static void __exit amimouse_exit(void)
{
input_unregister_device(&amimouse_dev);
input_unregister_device(amimouse_dev);
}

module_init(amimouse_init);
Expand Down
96 changes: 49 additions & 47 deletions trunk/drivers/input/mouse/inport.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,40 +87,7 @@ MODULE_PARM_DESC(irq, "IRQ number (5=default)");

__obsolete_setup("inport_irq=");

static irqreturn_t inport_interrupt(int irq, void *dev_id, struct pt_regs *regs);

static int inport_open(struct input_dev *dev)
{
if (request_irq(inport_irq, inport_interrupt, 0, "inport", NULL))
return -EBUSY;
outb(INPORT_REG_MODE, INPORT_CONTROL_PORT);
outb(INPORT_MODE_IRQ | INPORT_MODE_BASE, INPORT_DATA_PORT);

return 0;
}

static void inport_close(struct input_dev *dev)
{
outb(INPORT_REG_MODE, INPORT_CONTROL_PORT);
outb(INPORT_MODE_BASE, INPORT_DATA_PORT);
free_irq(inport_irq, NULL);
}

static struct input_dev inport_dev = {
.evbit = { BIT(EV_KEY) | BIT(EV_REL) },
.keybit = { [LONG(BTN_LEFT)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT) },
.relbit = { BIT(REL_X) | BIT(REL_Y) },
.open = inport_open,
.close = inport_close,
.name = INPORT_NAME,
.phys = "isa023c/input0",
.id = {
.bustype = BUS_ISA,
.vendor = INPORT_VENDOR,
.product = 0x0001,
.version = 0x0100,
},
};
static struct input_dev *inport_dev;

static irqreturn_t inport_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
Expand All @@ -129,31 +96,48 @@ static irqreturn_t inport_interrupt(int irq, void *dev_id, struct pt_regs *regs)
outb(INPORT_REG_MODE, INPORT_CONTROL_PORT);
outb(INPORT_MODE_HOLD | INPORT_MODE_IRQ | INPORT_MODE_BASE, INPORT_DATA_PORT);

input_regs(&inport_dev, regs);
input_regs(inport_dev, regs);

outb(INPORT_REG_X, INPORT_CONTROL_PORT);
input_report_rel(&inport_dev, REL_X, inb(INPORT_DATA_PORT));
input_report_rel(inport_dev, REL_X, inb(INPORT_DATA_PORT));

outb(INPORT_REG_Y, INPORT_CONTROL_PORT);
input_report_rel(&inport_dev, REL_Y, inb(INPORT_DATA_PORT));
input_report_rel(inport_dev, REL_Y, inb(INPORT_DATA_PORT));

outb(INPORT_REG_BTNS, INPORT_CONTROL_PORT);
buttons = inb(INPORT_DATA_PORT);

input_report_key(&inport_dev, BTN_MIDDLE, buttons & 1);
input_report_key(&inport_dev, BTN_LEFT, buttons & 2);
input_report_key(&inport_dev, BTN_RIGHT, buttons & 4);
input_report_key(inport_dev, BTN_MIDDLE, buttons & 1);
input_report_key(inport_dev, BTN_LEFT, buttons & 2);
input_report_key(inport_dev, BTN_RIGHT, buttons & 4);

outb(INPORT_REG_MODE, INPORT_CONTROL_PORT);
outb(INPORT_MODE_IRQ | INPORT_MODE_BASE, INPORT_DATA_PORT);

input_sync(&inport_dev);
input_sync(inport_dev);
return IRQ_HANDLED;
}

static int inport_open(struct input_dev *dev)
{
if (request_irq(inport_irq, inport_interrupt, 0, "inport", NULL))
return -EBUSY;
outb(INPORT_REG_MODE, INPORT_CONTROL_PORT);
outb(INPORT_MODE_IRQ | INPORT_MODE_BASE, INPORT_DATA_PORT);

return 0;
}

static void inport_close(struct input_dev *dev)
{
outb(INPORT_REG_MODE, INPORT_CONTROL_PORT);
outb(INPORT_MODE_BASE, INPORT_DATA_PORT);
free_irq(inport_irq, NULL);
}

static int __init inport_init(void)
{
unsigned char a,b,c;
unsigned char a, b, c;

if (!request_region(INPORT_BASE, INPORT_EXTENT, "inport")) {
printk(KERN_ERR "inport.c: Can't allocate ports at %#x\n", INPORT_BASE);
Expand All @@ -163,26 +147,44 @@ static int __init inport_init(void)
a = inb(INPORT_SIGNATURE_PORT);
b = inb(INPORT_SIGNATURE_PORT);
c = inb(INPORT_SIGNATURE_PORT);
if (( a == b ) || ( a != c )) {
if (a == b || a != c) {
release_region(INPORT_BASE, INPORT_EXTENT);
printk(KERN_ERR "inport.c: Didn't find InPort mouse at %#x\n", INPORT_BASE);
return -ENODEV;
}

if (!(inport_dev = input_allocate_device())) {
printk(KERN_ERR "inport.c: Not enough memory for input device\n");
release_region(INPORT_BASE, INPORT_EXTENT);
return -ENOMEM;
}

inport_dev->name = INPORT_NAME;
inport_dev->phys = "isa023c/input0";
inport_dev->id.bustype = BUS_ISA;
inport_dev->id.vendor = INPORT_VENDOR;
inport_dev->id.product = 0x0001;
inport_dev->id.version = 0x0100;

inport_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL);
inport_dev->keybit[LONG(BTN_LEFT)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT);
inport_dev->relbit[0] = BIT(REL_X) | BIT(REL_Y);

inport_dev->open = inport_open;
inport_dev->close = inport_close;

outb(INPORT_RESET, INPORT_CONTROL_PORT);
outb(INPORT_REG_MODE, INPORT_CONTROL_PORT);
outb(INPORT_MODE_BASE, INPORT_DATA_PORT);

input_register_device(&inport_dev);

printk(KERN_INFO "input: " INPORT_NAME " at %#x irq %d\n", INPORT_BASE, inport_irq);
input_register_device(inport_dev);

return 0;
}

static void __exit inport_exit(void)
{
input_unregister_device(&inport_dev);
input_unregister_device(inport_dev);
release_region(INPORT_BASE, INPORT_EXTENT);
}

Expand Down
16 changes: 9 additions & 7 deletions trunk/drivers/input/mouse/lifebook.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ static struct dmi_system_id lifebook_dmi_table[] = {
static psmouse_ret_t lifebook_process_byte(struct psmouse *psmouse, struct pt_regs *regs)
{
unsigned char *packet = psmouse->packet;
struct input_dev *dev = &psmouse->dev;
struct input_dev *dev = psmouse->dev;

if (psmouse->pktcnt != 3)
return PSMOUSE_GOOD_DATA;
Expand Down Expand Up @@ -113,15 +113,17 @@ int lifebook_detect(struct psmouse *psmouse, int set_properties)

int lifebook_init(struct psmouse *psmouse)
{
struct input_dev *input_dev = psmouse->dev;

if (lifebook_absolute_mode(psmouse))
return -1;

psmouse->dev.evbit[0] = BIT(EV_ABS) | BIT(EV_KEY) | BIT(EV_REL);
psmouse->dev.keybit[LONG(BTN_LEFT)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT);
psmouse->dev.keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH);
psmouse->dev.relbit[0] = BIT(REL_X) | BIT(REL_Y);
input_set_abs_params(&psmouse->dev, ABS_X, 0, 1024, 0, 0);
input_set_abs_params(&psmouse->dev, ABS_Y, 0, 1024, 0, 0);
input_dev->evbit[0] = BIT(EV_ABS) | BIT(EV_KEY) | BIT(EV_REL);
input_dev->keybit[LONG(BTN_LEFT)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT);
input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH);
input_dev->relbit[0] = BIT(REL_X) | BIT(REL_Y);
input_set_abs_params(input_dev, ABS_X, 0, 1024, 0, 0);
input_set_abs_params(input_dev, ABS_Y, 0, 1024, 0, 0);

psmouse->protocol_handler = lifebook_process_byte;
psmouse->set_resolution = lifebook_set_resolution;
Expand Down
Loading

0 comments on commit a30003e

Please sign in to comment.