Commit 6b3bf204 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
  Input: elantech - touchpad driver miss-recognising logitech mice
  Input: synaptics - ensure we reset the device on resume
  Input: usbtouchscreen - fix eGalax HID ignoring
  Input: ambakmi - fix timeout handling in amba_kmi_write()
  Input: pxa930_trkball - fix write timeout handling
  Input: struct device - replace bus_id with dev_name(), dev_set_name()
  Input: bf54x-keys - fix debounce time validation
  Input: spitzkbd - mark probe function as __devinit
  Input: omap-keypad - mark probe function as __devinit
  Input: corgi_ts - mark probe function as __devinit
  Input: corgikbd - mark probe function as __devinit
  Input: uvc - the button on the camera is KEY_CAMERA
  Input: psmouse - make MOUSE_PS2_LIFEBOOK depend on X86
  Input: atkbd - make forced_release_keys[] static
  Input: usbtouchscreen - allow reporting calibrated data
parents 36b31106 9ab7b25e
...@@ -839,7 +839,7 @@ static void atkbd_disconnect(struct serio *serio) ...@@ -839,7 +839,7 @@ static void atkbd_disconnect(struct serio *serio)
*/ */
static void atkbd_dell_laptop_keymap_fixup(struct atkbd *atkbd) static void atkbd_dell_laptop_keymap_fixup(struct atkbd *atkbd)
{ {
const unsigned int forced_release_keys[] = { static const unsigned int forced_release_keys[] = {
0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8f, 0x93, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8f, 0x93,
}; };
int i; int i;
...@@ -856,7 +856,7 @@ static void atkbd_dell_laptop_keymap_fixup(struct atkbd *atkbd) ...@@ -856,7 +856,7 @@ static void atkbd_dell_laptop_keymap_fixup(struct atkbd *atkbd)
*/ */
static void atkbd_hp_keymap_fixup(struct atkbd *atkbd) static void atkbd_hp_keymap_fixup(struct atkbd *atkbd)
{ {
const unsigned int forced_release_keys[] = { static const unsigned int forced_release_keys[] = {
0x94, 0x94,
}; };
int i; int i;
......
...@@ -209,8 +209,8 @@ static int __devinit bfin_kpad_probe(struct platform_device *pdev) ...@@ -209,8 +209,8 @@ static int __devinit bfin_kpad_probe(struct platform_device *pdev)
goto out; goto out;
} }
if (!pdata->debounce_time || !pdata->debounce_time > MAX_MULT || if (!pdata->debounce_time || pdata->debounce_time > MAX_MULT ||
!pdata->coldrive_time || !pdata->coldrive_time > MAX_MULT) { !pdata->coldrive_time || pdata->coldrive_time > MAX_MULT) {
printk(KERN_ERR DRV_NAME printk(KERN_ERR DRV_NAME
": Invalid Debounce/Columdrive Time from pdata\n"); ": Invalid Debounce/Columdrive Time from pdata\n");
bfin_write_KPAD_MSEL(0xFF0); /* Default MSEL */ bfin_write_KPAD_MSEL(0xFF0); /* Default MSEL */
......
...@@ -288,7 +288,7 @@ static int corgikbd_resume(struct platform_device *dev) ...@@ -288,7 +288,7 @@ static int corgikbd_resume(struct platform_device *dev)
#define corgikbd_resume NULL #define corgikbd_resume NULL
#endif #endif
static int __init corgikbd_probe(struct platform_device *pdev) static int __devinit corgikbd_probe(struct platform_device *pdev)
{ {
struct corgikbd *corgikbd; struct corgikbd *corgikbd;
struct input_dev *input_dev; struct input_dev *input_dev;
...@@ -368,7 +368,7 @@ static int __init corgikbd_probe(struct platform_device *pdev) ...@@ -368,7 +368,7 @@ static int __init corgikbd_probe(struct platform_device *pdev)
return err; return err;
} }
static int corgikbd_remove(struct platform_device *pdev) static int __devexit corgikbd_remove(struct platform_device *pdev)
{ {
int i; int i;
struct corgikbd *corgikbd = platform_get_drvdata(pdev); struct corgikbd *corgikbd = platform_get_drvdata(pdev);
...@@ -388,7 +388,7 @@ static int corgikbd_remove(struct platform_device *pdev) ...@@ -388,7 +388,7 @@ static int corgikbd_remove(struct platform_device *pdev)
static struct platform_driver corgikbd_driver = { static struct platform_driver corgikbd_driver = {
.probe = corgikbd_probe, .probe = corgikbd_probe,
.remove = corgikbd_remove, .remove = __devexit_p(corgikbd_remove),
.suspend = corgikbd_suspend, .suspend = corgikbd_suspend,
.resume = corgikbd_resume, .resume = corgikbd_resume,
.driver = { .driver = {
...@@ -397,7 +397,7 @@ static struct platform_driver corgikbd_driver = { ...@@ -397,7 +397,7 @@ static struct platform_driver corgikbd_driver = {
}, },
}; };
static int __devinit corgikbd_init(void) static int __init corgikbd_init(void)
{ {
return platform_driver_register(&corgikbd_driver); return platform_driver_register(&corgikbd_driver);
} }
......
...@@ -279,7 +279,7 @@ static int omap_kp_resume(struct platform_device *dev) ...@@ -279,7 +279,7 @@ static int omap_kp_resume(struct platform_device *dev)
#define omap_kp_resume NULL #define omap_kp_resume NULL
#endif #endif
static int __init omap_kp_probe(struct platform_device *pdev) static int __devinit omap_kp_probe(struct platform_device *pdev)
{ {
struct omap_kp *omap_kp; struct omap_kp *omap_kp;
struct input_dev *input_dev; struct input_dev *input_dev;
...@@ -422,7 +422,7 @@ static int __init omap_kp_probe(struct platform_device *pdev) ...@@ -422,7 +422,7 @@ static int __init omap_kp_probe(struct platform_device *pdev)
return -EINVAL; return -EINVAL;
} }
static int omap_kp_remove(struct platform_device *pdev) static int __devexit omap_kp_remove(struct platform_device *pdev)
{ {
struct omap_kp *omap_kp = platform_get_drvdata(pdev); struct omap_kp *omap_kp = platform_get_drvdata(pdev);
...@@ -454,7 +454,7 @@ static int omap_kp_remove(struct platform_device *pdev) ...@@ -454,7 +454,7 @@ static int omap_kp_remove(struct platform_device *pdev)
static struct platform_driver omap_kp_driver = { static struct platform_driver omap_kp_driver = {
.probe = omap_kp_probe, .probe = omap_kp_probe,
.remove = omap_kp_remove, .remove = __devexit_p(omap_kp_remove),
.suspend = omap_kp_suspend, .suspend = omap_kp_suspend,
.resume = omap_kp_resume, .resume = omap_kp_resume,
.driver = { .driver = {
...@@ -463,7 +463,7 @@ static struct platform_driver omap_kp_driver = { ...@@ -463,7 +463,7 @@ static struct platform_driver omap_kp_driver = {
}, },
}; };
static int __devinit omap_kp_init(void) static int __init omap_kp_init(void)
{ {
printk(KERN_INFO "OMAP Keypad Driver\n"); printk(KERN_INFO "OMAP Keypad Driver\n");
return platform_driver_register(&omap_kp_driver); return platform_driver_register(&omap_kp_driver);
......
...@@ -343,7 +343,7 @@ static int spitzkbd_resume(struct platform_device *dev) ...@@ -343,7 +343,7 @@ static int spitzkbd_resume(struct platform_device *dev)
#define spitzkbd_resume NULL #define spitzkbd_resume NULL
#endif #endif
static int __init spitzkbd_probe(struct platform_device *dev) static int __devinit spitzkbd_probe(struct platform_device *dev)
{ {
struct spitzkbd *spitzkbd; struct spitzkbd *spitzkbd;
struct input_dev *input_dev; struct input_dev *input_dev;
...@@ -444,7 +444,7 @@ static int __init spitzkbd_probe(struct platform_device *dev) ...@@ -444,7 +444,7 @@ static int __init spitzkbd_probe(struct platform_device *dev)
return err; return err;
} }
static int spitzkbd_remove(struct platform_device *dev) static int __devexit spitzkbd_remove(struct platform_device *dev)
{ {
int i; int i;
struct spitzkbd *spitzkbd = platform_get_drvdata(dev); struct spitzkbd *spitzkbd = platform_get_drvdata(dev);
...@@ -470,7 +470,7 @@ static int spitzkbd_remove(struct platform_device *dev) ...@@ -470,7 +470,7 @@ static int spitzkbd_remove(struct platform_device *dev)
static struct platform_driver spitzkbd_driver = { static struct platform_driver spitzkbd_driver = {
.probe = spitzkbd_probe, .probe = spitzkbd_probe,
.remove = spitzkbd_remove, .remove = __devexit_p(spitzkbd_remove),
.suspend = spitzkbd_suspend, .suspend = spitzkbd_suspend,
.resume = spitzkbd_resume, .resume = spitzkbd_resume,
.driver = { .driver = {
...@@ -479,7 +479,7 @@ static struct platform_driver spitzkbd_driver = { ...@@ -479,7 +479,7 @@ static struct platform_driver spitzkbd_driver = {
}, },
}; };
static int __devinit spitzkbd_init(void) static int __init spitzkbd_init(void)
{ {
return platform_driver_register(&spitzkbd_driver); return platform_driver_register(&spitzkbd_driver);
} }
......
...@@ -70,7 +70,7 @@ config MOUSE_PS2_SYNAPTICS ...@@ -70,7 +70,7 @@ config MOUSE_PS2_SYNAPTICS
config MOUSE_PS2_LIFEBOOK config MOUSE_PS2_LIFEBOOK
bool "Fujitsu Lifebook PS/2 mouse protocol extension" if EMBEDDED bool "Fujitsu Lifebook PS/2 mouse protocol extension" if EMBEDDED
default y default y
depends on MOUSE_PS2 depends on MOUSE_PS2 && X86
help help
Say Y here if you have a Fujitsu B-series Lifebook PS/2 Say Y here if you have a Fujitsu B-series Lifebook PS/2
TouchScreen connected to your system. TouchScreen connected to your system.
......
...@@ -542,7 +542,7 @@ int elantech_detect(struct psmouse *psmouse, int set_properties) ...@@ -542,7 +542,7 @@ int elantech_detect(struct psmouse *psmouse, int set_properties)
ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSCALE11) || ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSCALE11) ||
ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSCALE11) || ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSCALE11) ||
ps2_command(ps2dev, param, PSMOUSE_CMD_GETINFO)) { ps2_command(ps2dev, param, PSMOUSE_CMD_GETINFO)) {
pr_err("elantech.c: sending Elantech magic knock failed.\n"); pr_debug("elantech.c: sending Elantech magic knock failed.\n");
return -1; return -1;
} }
...@@ -551,8 +551,27 @@ int elantech_detect(struct psmouse *psmouse, int set_properties) ...@@ -551,8 +551,27 @@ int elantech_detect(struct psmouse *psmouse, int set_properties)
* set of magic numbers * set of magic numbers
*/ */
if (param[0] != 0x3c || param[1] != 0x03 || param[2] != 0xc8) { if (param[0] != 0x3c || param[1] != 0x03 || param[2] != 0xc8) {
pr_info("elantech.c: unexpected magic knock result 0x%02x, 0x%02x, 0x%02x.\n", pr_debug("elantech.c: "
param[0], param[1], param[2]); "unexpected magic knock result 0x%02x, 0x%02x, 0x%02x.\n",
param[0], param[1], param[2]);
return -1;
}
/*
* Query touchpad's firmware version and see if it reports known
* value to avoid mis-detection. Logitech mice are known to respond
* to Elantech magic knock and there might be more.
*/
if (synaptics_send_cmd(psmouse, ETP_FW_VERSION_QUERY, param)) {
pr_debug("elantech.c: failed to query firmware version.\n");
return -1;
}
pr_debug("elantech.c: Elantech version query result 0x%02x, 0x%02x, 0x%02x.\n",
param[0], param[1], param[2]);
if (param[0] == 0 || param[1] != 0) {
pr_debug("elantech.c: Probably not a real Elantech touchpad. Aborting.\n");
return -1; return -1;
} }
...@@ -600,8 +619,7 @@ int elantech_init(struct psmouse *psmouse) ...@@ -600,8 +619,7 @@ int elantech_init(struct psmouse *psmouse)
int i, error; int i, error;
unsigned char param[3]; unsigned char param[3];
etd = kzalloc(sizeof(struct elantech_data), GFP_KERNEL); psmouse->private = etd = kzalloc(sizeof(struct elantech_data), GFP_KERNEL);
psmouse->private = etd;
if (!etd) if (!etd)
return -1; return -1;
...@@ -610,14 +628,12 @@ int elantech_init(struct psmouse *psmouse) ...@@ -610,14 +628,12 @@ int elantech_init(struct psmouse *psmouse)
etd->parity[i] = etd->parity[i & (i - 1)] ^ 1; etd->parity[i] = etd->parity[i & (i - 1)] ^ 1;
/* /*
* Find out what version hardware this is * Do the version query again so we can store the result
*/ */
if (synaptics_send_cmd(psmouse, ETP_FW_VERSION_QUERY, param)) { if (synaptics_send_cmd(psmouse, ETP_FW_VERSION_QUERY, param)) {
pr_err("elantech.c: failed to query firmware version.\n"); pr_err("elantech.c: failed to query firmware version.\n");
goto init_fail; goto init_fail;
} }
pr_info("elantech.c: Elantech version query result 0x%02x, 0x%02x, 0x%02x.\n",
param[0], param[1], param[2]);
etd->fw_version_maj = param[0]; etd->fw_version_maj = param[0];
etd->fw_version_min = param[2]; etd->fw_version_min = param[2];
......
...@@ -83,7 +83,7 @@ static int write_tbcr(struct pxa930_trkball *trkball, int v) ...@@ -83,7 +83,7 @@ static int write_tbcr(struct pxa930_trkball *trkball, int v)
__raw_writel(v, trkball->mmio_base + TBCR); __raw_writel(v, trkball->mmio_base + TBCR);
while (i--) { while (--i) {
if (__raw_readl(trkball->mmio_base + TBCR) == v) if (__raw_readl(trkball->mmio_base + TBCR) == v)
break; break;
msleep(1); msleep(1);
......
...@@ -182,11 +182,6 @@ static int synaptics_identify(struct psmouse *psmouse) ...@@ -182,11 +182,6 @@ static int synaptics_identify(struct psmouse *psmouse)
static int synaptics_query_hardware(struct psmouse *psmouse) static int synaptics_query_hardware(struct psmouse *psmouse)
{ {
int retries = 0;
while ((retries++ < 3) && psmouse_reset(psmouse))
/* empty */;
if (synaptics_identify(psmouse)) if (synaptics_identify(psmouse))
return -1; return -1;
if (synaptics_model_id(psmouse)) if (synaptics_model_id(psmouse))
...@@ -582,6 +577,8 @@ static int synaptics_reconnect(struct psmouse *psmouse) ...@@ -582,6 +577,8 @@ static int synaptics_reconnect(struct psmouse *psmouse)
struct synaptics_data *priv = psmouse->private; struct synaptics_data *priv = psmouse->private;
struct synaptics_data old_priv = *priv; struct synaptics_data old_priv = *priv;
psmouse_reset(psmouse);
if (synaptics_detect(psmouse, 0)) if (synaptics_detect(psmouse, 0))
return -1; return -1;
...@@ -640,6 +637,8 @@ int synaptics_init(struct psmouse *psmouse) ...@@ -640,6 +637,8 @@ int synaptics_init(struct psmouse *psmouse)
if (!priv) if (!priv)
return -1; return -1;
psmouse_reset(psmouse);
if (synaptics_query_hardware(psmouse)) { if (synaptics_query_hardware(psmouse)) {
printk(KERN_ERR "Unable to query Synaptics hardware.\n"); printk(KERN_ERR "Unable to query Synaptics hardware.\n");
goto init_fail; goto init_fail;
......
...@@ -57,7 +57,7 @@ static int amba_kmi_write(struct serio *io, unsigned char val) ...@@ -57,7 +57,7 @@ static int amba_kmi_write(struct serio *io, unsigned char val)
struct amba_kmi_port *kmi = io->port_data; struct amba_kmi_port *kmi = io->port_data;
unsigned int timeleft = 10000; /* timeout in 100ms */ unsigned int timeleft = 10000; /* timeout in 100ms */
while ((readb(KMISTAT) & KMISTAT_TXEMPTY) == 0 && timeleft--) while ((readb(KMISTAT) & KMISTAT_TXEMPTY) == 0 && --timeleft)
udelay(10); udelay(10);
if (timeleft) if (timeleft)
...@@ -129,8 +129,8 @@ static int amba_kmi_probe(struct amba_device *dev, void *id) ...@@ -129,8 +129,8 @@ static int amba_kmi_probe(struct amba_device *dev, void *id)
io->write = amba_kmi_write; io->write = amba_kmi_write;
io->open = amba_kmi_open; io->open = amba_kmi_open;
io->close = amba_kmi_close; io->close = amba_kmi_close;
strlcpy(io->name, dev->dev.bus_id, sizeof(io->name)); strlcpy(io->name, dev_name(&dev->dev), sizeof(io->name));
strlcpy(io->phys, dev->dev.bus_id, sizeof(io->phys)); strlcpy(io->phys, dev_name(&dev->dev), sizeof(io->phys));
io->port_data = kmi; io->port_data = kmi;
io->dev.parent = &dev->dev; io->dev.parent = &dev->dev;
......
...@@ -359,7 +359,7 @@ static int __init gscps2_probe(struct parisc_device *dev) ...@@ -359,7 +359,7 @@ static int __init gscps2_probe(struct parisc_device *dev)
snprintf(serio->name, sizeof(serio->name), "GSC PS/2 %s", snprintf(serio->name, sizeof(serio->name), "GSC PS/2 %s",
(ps2port->id == GSC_ID_KEYBOARD) ? "keyboard" : "mouse"); (ps2port->id == GSC_ID_KEYBOARD) ? "keyboard" : "mouse");
strlcpy(serio->phys, dev->dev.bus_id, sizeof(serio->phys)); strlcpy(serio->phys, dev_name(&dev->dev), sizeof(serio->phys));
serio->id.type = SERIO_8042; serio->id.type = SERIO_8042;
serio->write = gscps2_write; serio->write = gscps2_write;
serio->open = gscps2_open; serio->open = gscps2_open;
......
...@@ -246,8 +246,8 @@ static int __devinit ps2_probe(struct sa1111_dev *dev) ...@@ -246,8 +246,8 @@ static int __devinit ps2_probe(struct sa1111_dev *dev)
serio->write = ps2_write; serio->write = ps2_write;
serio->open = ps2_open; serio->open = ps2_open;
serio->close = ps2_close; serio->close = ps2_close;
strlcpy(serio->name, dev->dev.bus_id, sizeof(serio->name)); strlcpy(serio->name, dev_name(&dev->dev), sizeof(serio->name));
strlcpy(serio->phys, dev->dev.bus_id, sizeof(serio->phys)); strlcpy(serio->phys, dev_name(&dev->dev), sizeof(serio->phys));
serio->port_data = ps2if; serio->port_data = ps2if;
serio->dev.parent = &dev->dev; serio->dev.parent = &dev->dev;
ps2if->io = serio; ps2if->io = serio;
......
...@@ -236,7 +236,7 @@ static int __devinit atmel_tsadcc_probe(struct platform_device *pdev) ...@@ -236,7 +236,7 @@ static int __devinit atmel_tsadcc_probe(struct platform_device *pdev)
ts_dev->bufferedmeasure = 0; ts_dev->bufferedmeasure = 0;
snprintf(ts_dev->phys, sizeof(ts_dev->phys), snprintf(ts_dev->phys, sizeof(ts_dev->phys),
"%s/input0", pdev->dev.bus_id); "%s/input0", dev_name(&pdev->dev));
input_dev->name = "atmel touch screen controller"; input_dev->name = "atmel touch screen controller";
input_dev->phys = ts_dev->phys; input_dev->phys = ts_dev->phys;
......
...@@ -268,7 +268,7 @@ static int corgits_resume(struct platform_device *dev) ...@@ -268,7 +268,7 @@ static int corgits_resume(struct platform_device *dev)
#define corgits_resume NULL #define corgits_resume NULL
#endif #endif
static int __init corgits_probe(struct platform_device *pdev) static int __devinit corgits_probe(struct platform_device *pdev)
{ {
struct corgi_ts *corgi_ts; struct corgi_ts *corgi_ts;
struct input_dev *input_dev; struct input_dev *input_dev;
...@@ -343,7 +343,7 @@ static int __init corgits_probe(struct platform_device *pdev) ...@@ -343,7 +343,7 @@ static int __init corgits_probe(struct platform_device *pdev)
return err; return err;
} }
static int corgits_remove(struct platform_device *pdev) static int __devexit corgits_remove(struct platform_device *pdev)
{ {
struct corgi_ts *corgi_ts = platform_get_drvdata(pdev); struct corgi_ts *corgi_ts = platform_get_drvdata(pdev);
...@@ -352,12 +352,13 @@ static int corgits_remove(struct platform_device *pdev) ...@@ -352,12 +352,13 @@ static int corgits_remove(struct platform_device *pdev)
corgi_ts->machinfo->put_hsync(); corgi_ts->machinfo->put_hsync();
input_unregister_device(corgi_ts->input); input_unregister_device(corgi_ts->input);
kfree(corgi_ts); kfree(corgi_ts);
return 0; return 0;
} }
static struct platform_driver corgits_driver = { static struct platform_driver corgits_driver = {
.probe = corgits_probe, .probe = corgits_probe,
.remove = corgits_remove, .remove = __devexit_p(corgits_remove),
.suspend = corgits_suspend, .suspend = corgits_suspend,
.resume = corgits_resume, .resume = corgits_resume,
.driver = { .driver = {
...@@ -366,7 +367,7 @@ static struct platform_driver corgits_driver = { ...@@ -366,7 +367,7 @@ static struct platform_driver corgits_driver = {
}, },
}; };
static int __devinit corgits_init(void) static int __init corgits_init(void)
{ {
return platform_driver_register(&corgits_driver); return platform_driver_register(&corgits_driver);
} }
......
...@@ -289,7 +289,8 @@ static int tsc2007_probe(struct i2c_client *client, ...@@ -289,7 +289,8 @@ static int tsc2007_probe(struct i2c_client *client,
pdata->init_platform_hw(); pdata->init_platform_hw();
snprintf(ts->phys, sizeof(ts->phys), "%s/input0", client->dev.bus_id); snprintf(ts->phys, sizeof(ts->phys),
"%s/input0", dev_name(&client->dev));
input_dev->name = "TSC2007 Touchscreen"; input_dev->name = "TSC2007 Touchscreen";
input_dev->phys = ts->phys; input_dev->phys = ts->phys;
......
...@@ -60,6 +60,10 @@ static int swap_xy; ...@@ -60,6 +60,10 @@ static int swap_xy;
module_param(swap_xy, bool, 0644); module_param(swap_xy, bool, 0644);
MODULE_PARM_DESC(swap_xy, "If set X and Y axes are swapped."); MODULE_PARM_DESC(swap_xy, "If set X and Y axes are swapped.");
static int hwcalib_xy;
module_param(hwcalib_xy, bool, 0644);
MODULE_PARM_DESC(hwcalib_xy, "If set hw-calibrated X/Y are used if available");
/* device specifc data/functions */ /* device specifc data/functions */
struct usbtouch_usb; struct usbtouch_usb;
struct usbtouch_device_info { struct usbtouch_device_info {
...@@ -118,6 +122,7 @@ enum { ...@@ -118,6 +122,7 @@ enum {
#define USB_DEVICE_HID_CLASS(vend, prod) \ #define USB_DEVICE_HID_CLASS(vend, prod) \
.match_flags = USB_DEVICE_ID_MATCH_INT_CLASS \ .match_flags = USB_DEVICE_ID_MATCH_INT_CLASS \
| USB_DEVICE_ID_MATCH_INT_PROTOCOL \
| USB_DEVICE_ID_MATCH_DEVICE, \ | USB_DEVICE_ID_MATCH_DEVICE, \
.idVendor = (vend), \ .idVendor = (vend), \
.idProduct = (prod), \ .idProduct = (prod), \
...@@ -260,8 +265,13 @@ static int panjit_read_data(struct usbtouch_usb *dev, unsigned char *pkt) ...@@ -260,8 +265,13 @@ static int panjit_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
static int mtouch_read_data(struct usbtouch_usb *dev, unsigned char *pkt) static int mtouch_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
{ {
dev->x = (pkt[8] << 8) | pkt[7]; if (hwcalib_xy) {
dev->y = (pkt[10] << 8) | pkt[9]; dev->x = (pkt[4] << 8) | pkt[3];
dev->y = 0xffff - ((pkt[6] << 8) | pkt[5]);
} else {
dev->x = (pkt[8] << 8) | pkt[7];
dev->y = (pkt[10] << 8) | pkt[9];
}
dev->touch = (pkt[2] & 0x40) ? 1 : 0; dev->touch = (pkt[2] & 0x40) ? 1 : 0;
return 1; return 1;
...@@ -294,6 +304,12 @@ static int mtouch_init(struct usbtouch_usb *usbtouch) ...@@ -294,6 +304,12 @@ static int mtouch_init(struct usbtouch_usb *usbtouch)
return ret; return ret;
} }
/* Default min/max xy are the raw values, override if using hw-calib */
if (hwcalib_xy) {
input_set_abs_params(usbtouch->input, ABS_X, 0, 0xffff, 0, 0);
input_set_abs_params(usbtouch->input, ABS_Y, 0, 0xffff, 0, 0);
}
return 0; return 0;
} }
#endif #endif
......
...@@ -46,8 +46,8 @@ static int uvc_input_init(struct uvc_device *dev) ...@@ -46,8 +46,8 @@ static int uvc_input_init(struct uvc_device *dev)
usb_to_input_id(udev, &input->id); usb_to_input_id(udev, &input->id);
input->dev.parent = &dev->intf->dev; input->dev.parent = &dev->intf->dev;
set_bit(EV_KEY, input->evbit); __set_bit(EV_KEY, input->evbit);
set_bit(BTN_0, input->keybit); __set_bit(KEY_CAMERA, input->keybit);
if ((ret = input_register_device(input)) < 0) if ((ret = input_register_device(input)) < 0)
goto error; goto error;
...@@ -70,8 +70,10 @@ static void uvc_input_cleanup(struct uvc_device *dev) ...@@ -70,8 +70,10 @@ static void uvc_input_cleanup(struct uvc_device *dev)
static void uvc_input_report_key(struct uvc_device *dev, unsigned int code, static void uvc_input_report_key(struct uvc_device *dev, unsigned int code,
int value) int value)
{ {
if (dev->input) if (dev->input) {
input_report_key(dev->input, code, value); input_report_key(dev->input, code, value);
input_sync(dev->input);
}
} }
#else #else
...@@ -96,7 +98,7 @@ static void uvc_event_streaming(struct uvc_device *dev, __u8 *data, int len) ...@@ -96,7 +98,7 @@ static void uvc_event_streaming(struct uvc_device *dev, __u8 *data, int len)
return; return;
uvc_trace(UVC_TRACE_STATUS, "Button (intf %u) %s len %d\n", uvc_trace(UVC_TRACE_STATUS, "Button (intf %u) %s len %d\n",
data[1], data[3] ? "pressed" : "released", len); data[1], data[3] ? "pressed" : "released", len);
uvc_input_report_key(dev, BTN_0, data[3]); uvc_input_report_key(dev, KEY_CAMERA, data[3]);
} else { } else {
uvc_trace(UVC_TRACE_STATUS, "Stream %u error event %02x %02x " uvc_trace(UVC_TRACE_STATUS, "Stream %u error event %02x %02x "
"len %d.\n", data[1], data[2], data[3], len); "len %d.\n", data[1], data[2], data[3], len);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment