提交 e5f468b3 编写于 作者: L Linus Torvalds

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

Pull input fixes from Dmitry Torokhov:

 - joydev now implements a blacklist to avoid creating joystick nodes
   for accelerometers found in composite devices such as PlaStation
   controllers

 - assorted driver fixes

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
  Input: ims-psu - check if CDC union descriptor is sane
  Input: joydev - blacklist ds3/ds4/udraw motion sensors
  Input: allow matching device IDs on property bits
  Input: factor out and export input_device_id matching code
  Input: goodix - poll the 'buffer status' bit before reading data
  Input: axp20x-pek - fix module not auto-loading for axp221 pek
  Input: tca8418 - enable interrupt after it has been requested
  Input: stmfts - fix setting ABS_MT_POSITION_* maximum size
  Input: ti_am335x_tsc - fix incorrect step config for 5 wire touchscreen
  Input: synaptics - disable kernel tracking on SMBus devices
...@@ -933,58 +933,52 @@ int input_set_keycode(struct input_dev *dev, ...@@ -933,58 +933,52 @@ int input_set_keycode(struct input_dev *dev,
} }
EXPORT_SYMBOL(input_set_keycode); EXPORT_SYMBOL(input_set_keycode);
bool input_match_device_id(const struct input_dev *dev,
const struct input_device_id *id)
{
if (id->flags & INPUT_DEVICE_ID_MATCH_BUS)
if (id->bustype != dev->id.bustype)
return false;
if (id->flags & INPUT_DEVICE_ID_MATCH_VENDOR)
if (id->vendor != dev->id.vendor)
return false;
if (id->flags & INPUT_DEVICE_ID_MATCH_PRODUCT)
if (id->product != dev->id.product)
return false;
if (id->flags & INPUT_DEVICE_ID_MATCH_VERSION)
if (id->version != dev->id.version)
return false;
if (!bitmap_subset(id->evbit, dev->evbit, EV_MAX) ||
!bitmap_subset(id->keybit, dev->keybit, KEY_MAX) ||
!bitmap_subset(id->relbit, dev->relbit, REL_MAX) ||
!bitmap_subset(id->absbit, dev->absbit, ABS_MAX) ||
!bitmap_subset(id->mscbit, dev->mscbit, MSC_MAX) ||
!bitmap_subset(id->ledbit, dev->ledbit, LED_MAX) ||
!bitmap_subset(id->sndbit, dev->sndbit, SND_MAX) ||
!bitmap_subset(id->ffbit, dev->ffbit, FF_MAX) ||
!bitmap_subset(id->swbit, dev->swbit, SW_MAX) ||
!bitmap_subset(id->propbit, dev->propbit, INPUT_PROP_MAX)) {
return false;
}
return true;
}
EXPORT_SYMBOL(input_match_device_id);
static const struct input_device_id *input_match_device(struct input_handler *handler, static const struct input_device_id *input_match_device(struct input_handler *handler,
struct input_dev *dev) struct input_dev *dev)
{ {
const struct input_device_id *id; const struct input_device_id *id;
for (id = handler->id_table; id->flags || id->driver_info; id++) { for (id = handler->id_table; id->flags || id->driver_info; id++) {
if (input_match_device_id(dev, id) &&
if (id->flags & INPUT_DEVICE_ID_MATCH_BUS) (!handler->match || handler->match(handler, dev))) {
if (id->bustype != dev->id.bustype)
continue;
if (id->flags & INPUT_DEVICE_ID_MATCH_VENDOR)
if (id->vendor != dev->id.vendor)
continue;
if (id->flags & INPUT_DEVICE_ID_MATCH_PRODUCT)
if (id->product != dev->id.product)
continue;
if (id->flags & INPUT_DEVICE_ID_MATCH_VERSION)
if (id->version != dev->id.version)
continue;
if (!bitmap_subset(id->evbit, dev->evbit, EV_MAX))
continue;
if (!bitmap_subset(id->keybit, dev->keybit, KEY_MAX))
continue;
if (!bitmap_subset(id->relbit, dev->relbit, REL_MAX))
continue;
if (!bitmap_subset(id->absbit, dev->absbit, ABS_MAX))
continue;
if (!bitmap_subset(id->mscbit, dev->mscbit, MSC_MAX))
continue;
if (!bitmap_subset(id->ledbit, dev->ledbit, LED_MAX))
continue;
if (!bitmap_subset(id->sndbit, dev->sndbit, SND_MAX))
continue;
if (!bitmap_subset(id->ffbit, dev->ffbit, FF_MAX))
continue;
if (!bitmap_subset(id->swbit, dev->swbit, SW_MAX))
continue;
if (!handler->match || handler->match(handler, dev))
return id; return id;
}
} }
return NULL; return NULL;
......
...@@ -747,6 +747,68 @@ static void joydev_cleanup(struct joydev *joydev) ...@@ -747,6 +747,68 @@ static void joydev_cleanup(struct joydev *joydev)
input_close_device(handle); input_close_device(handle);
} }
/*
* These codes are copied from from hid-ids.h, unfortunately there is no common
* usb_ids/bt_ids.h header.
*/
#define USB_VENDOR_ID_SONY 0x054c
#define USB_DEVICE_ID_SONY_PS3_CONTROLLER 0x0268
#define USB_DEVICE_ID_SONY_PS4_CONTROLLER 0x05c4
#define USB_DEVICE_ID_SONY_PS4_CONTROLLER_2 0x09cc
#define USB_DEVICE_ID_SONY_PS4_CONTROLLER_DONGLE 0x0ba0
#define USB_VENDOR_ID_THQ 0x20d6
#define USB_DEVICE_ID_THQ_PS3_UDRAW 0xcb17
#define ACCEL_DEV(vnd, prd) \
{ \
.flags = INPUT_DEVICE_ID_MATCH_VENDOR | \
INPUT_DEVICE_ID_MATCH_PRODUCT | \
INPUT_DEVICE_ID_MATCH_PROPBIT, \
.vendor = (vnd), \
.product = (prd), \
.propbit = { BIT_MASK(INPUT_PROP_ACCELEROMETER) }, \
}
static const struct input_device_id joydev_blacklist[] = {
/* Avoid touchpads and touchscreens */
{
.flags = INPUT_DEVICE_ID_MATCH_EVBIT |
INPUT_DEVICE_ID_MATCH_KEYBIT,
.evbit = { BIT_MASK(EV_KEY) },
.keybit = { [BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH) },
},
/* Avoid tablets, digitisers and similar devices */
{
.flags = INPUT_DEVICE_ID_MATCH_EVBIT |
INPUT_DEVICE_ID_MATCH_KEYBIT,
.evbit = { BIT_MASK(EV_KEY) },
.keybit = { [BIT_WORD(BTN_DIGI)] = BIT_MASK(BTN_DIGI) },
},
/* Disable accelerometers on composite devices */
ACCEL_DEV(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER),
ACCEL_DEV(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS4_CONTROLLER),
ACCEL_DEV(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS4_CONTROLLER_2),
ACCEL_DEV(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS4_CONTROLLER_DONGLE),
ACCEL_DEV(USB_VENDOR_ID_THQ, USB_DEVICE_ID_THQ_PS3_UDRAW),
{ /* sentinel */ }
};
static bool joydev_dev_is_blacklisted(struct input_dev *dev)
{
const struct input_device_id *id;
for (id = joydev_blacklist; id->flags; id++) {
if (input_match_device_id(dev, id)) {
dev_dbg(&dev->dev,
"joydev: blacklisting '%s'\n", dev->name);
return true;
}
}
return false;
}
static bool joydev_dev_is_absolute_mouse(struct input_dev *dev) static bool joydev_dev_is_absolute_mouse(struct input_dev *dev)
{ {
DECLARE_BITMAP(jd_scratch, KEY_CNT); DECLARE_BITMAP(jd_scratch, KEY_CNT);
...@@ -807,12 +869,8 @@ static bool joydev_dev_is_absolute_mouse(struct input_dev *dev) ...@@ -807,12 +869,8 @@ static bool joydev_dev_is_absolute_mouse(struct input_dev *dev)
static bool joydev_match(struct input_handler *handler, struct input_dev *dev) static bool joydev_match(struct input_handler *handler, struct input_dev *dev)
{ {
/* Avoid touchpads and touchscreens */ /* Disable blacklisted devices */
if (test_bit(EV_KEY, dev->evbit) && test_bit(BTN_TOUCH, dev->keybit)) if (joydev_dev_is_blacklisted(dev))
return false;
/* Avoid tablets, digitisers and similar devices */
if (test_bit(EV_KEY, dev->evbit) && test_bit(BTN_DIGI, dev->keybit))
return false; return false;
/* Avoid absolute mice */ /* Avoid absolute mice */
......
...@@ -234,14 +234,7 @@ static irqreturn_t tca8418_irq_handler(int irq, void *dev_id) ...@@ -234,14 +234,7 @@ static irqreturn_t tca8418_irq_handler(int irq, void *dev_id)
static int tca8418_configure(struct tca8418_keypad *keypad_data, static int tca8418_configure(struct tca8418_keypad *keypad_data,
u32 rows, u32 cols) u32 rows, u32 cols)
{ {
int reg, error; int reg, error = 0;
/* Write config register, if this fails assume device not present */
error = tca8418_write_byte(keypad_data, REG_CFG,
CFG_INT_CFG | CFG_OVR_FLOW_IEN | CFG_KE_IEN);
if (error < 0)
return -ENODEV;
/* Assemble a mask for row and column registers */ /* Assemble a mask for row and column registers */
reg = ~(~0 << rows); reg = ~(~0 << rows);
...@@ -257,6 +250,12 @@ static int tca8418_configure(struct tca8418_keypad *keypad_data, ...@@ -257,6 +250,12 @@ static int tca8418_configure(struct tca8418_keypad *keypad_data,
error |= tca8418_write_byte(keypad_data, REG_DEBOUNCE_DIS2, reg >> 8); error |= tca8418_write_byte(keypad_data, REG_DEBOUNCE_DIS2, reg >> 8);
error |= tca8418_write_byte(keypad_data, REG_DEBOUNCE_DIS3, reg >> 16); error |= tca8418_write_byte(keypad_data, REG_DEBOUNCE_DIS3, reg >> 16);
if (error)
return error;
error = tca8418_write_byte(keypad_data, REG_CFG,
CFG_INT_CFG | CFG_OVR_FLOW_IEN | CFG_KE_IEN);
return error; return error;
} }
...@@ -268,6 +267,7 @@ static int tca8418_keypad_probe(struct i2c_client *client, ...@@ -268,6 +267,7 @@ static int tca8418_keypad_probe(struct i2c_client *client,
struct input_dev *input; struct input_dev *input;
u32 rows = 0, cols = 0; u32 rows = 0, cols = 0;
int error, row_shift, max_keys; int error, row_shift, max_keys;
u8 reg;
/* Check i2c driver capabilities */ /* Check i2c driver capabilities */
if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE)) { if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE)) {
...@@ -301,10 +301,10 @@ static int tca8418_keypad_probe(struct i2c_client *client, ...@@ -301,10 +301,10 @@ static int tca8418_keypad_probe(struct i2c_client *client,
keypad_data->client = client; keypad_data->client = client;
keypad_data->row_shift = row_shift; keypad_data->row_shift = row_shift;
/* Initialize the chip or fail if chip isn't present */ /* Read key lock register, if this fails assume device not present */
error = tca8418_configure(keypad_data, rows, cols); error = tca8418_read_byte(keypad_data, REG_KEY_LCK_EC, &reg);
if (error < 0) if (error)
return error; return -ENODEV;
/* Configure input device */ /* Configure input device */
input = devm_input_allocate_device(dev); input = devm_input_allocate_device(dev);
...@@ -340,6 +340,11 @@ static int tca8418_keypad_probe(struct i2c_client *client, ...@@ -340,6 +340,11 @@ static int tca8418_keypad_probe(struct i2c_client *client,
return error; return error;
} }
/* Initialize the chip */
error = tca8418_configure(keypad_data, rows, cols);
if (error < 0)
return error;
error = input_register_device(input); error = input_register_device(input);
if (error) { if (error) {
dev_err(dev, "Unable to register input device, error: %d\n", dev_err(dev, "Unable to register input device, error: %d\n",
......
...@@ -403,6 +403,7 @@ static const struct platform_device_id axp_pek_id_match[] = { ...@@ -403,6 +403,7 @@ static const struct platform_device_id axp_pek_id_match[] = {
}, },
{ /* sentinel */ } { /* sentinel */ }
}; };
MODULE_DEVICE_TABLE(platform, axp_pek_id_match);
static struct platform_driver axp20x_pek_driver = { static struct platform_driver axp20x_pek_driver = {
.probe = axp20x_pek_probe, .probe = axp20x_pek_probe,
...@@ -417,4 +418,3 @@ module_platform_driver(axp20x_pek_driver); ...@@ -417,4 +418,3 @@ module_platform_driver(axp20x_pek_driver);
MODULE_DESCRIPTION("axp20x Power Button"); MODULE_DESCRIPTION("axp20x Power Button");
MODULE_AUTHOR("Carlo Caione <carlo@caione.org>"); MODULE_AUTHOR("Carlo Caione <carlo@caione.org>");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:axp20x-pek");
...@@ -1635,13 +1635,25 @@ ims_pcu_get_cdc_union_desc(struct usb_interface *intf) ...@@ -1635,13 +1635,25 @@ ims_pcu_get_cdc_union_desc(struct usb_interface *intf)
return NULL; return NULL;
} }
while (buflen > 0) { while (buflen >= sizeof(*union_desc)) {
union_desc = (struct usb_cdc_union_desc *)buf; union_desc = (struct usb_cdc_union_desc *)buf;
if (union_desc->bLength > buflen) {
dev_err(&intf->dev, "Too large descriptor\n");
return NULL;
}
if (union_desc->bDescriptorType == USB_DT_CS_INTERFACE && if (union_desc->bDescriptorType == USB_DT_CS_INTERFACE &&
union_desc->bDescriptorSubType == USB_CDC_UNION_TYPE) { union_desc->bDescriptorSubType == USB_CDC_UNION_TYPE) {
dev_dbg(&intf->dev, "Found union header\n"); dev_dbg(&intf->dev, "Found union header\n");
return union_desc;
if (union_desc->bLength >= sizeof(*union_desc))
return union_desc;
dev_err(&intf->dev,
"Union descriptor to short (%d vs %zd\n)",
union_desc->bLength, sizeof(*union_desc));
return NULL;
} }
buflen -= union_desc->bLength; buflen -= union_desc->bLength;
......
...@@ -1709,8 +1709,7 @@ static int synaptics_create_intertouch(struct psmouse *psmouse, ...@@ -1709,8 +1709,7 @@ static int synaptics_create_intertouch(struct psmouse *psmouse,
.sensor_pdata = { .sensor_pdata = {
.sensor_type = rmi_sensor_touchpad, .sensor_type = rmi_sensor_touchpad,
.axis_align.flip_y = true, .axis_align.flip_y = true,
/* to prevent cursors jumps: */ .kernel_tracking = false,
.kernel_tracking = true,
.topbuttonpad = topbuttonpad, .topbuttonpad = topbuttonpad,
}, },
.f30_data = { .f30_data = {
......
...@@ -72,6 +72,9 @@ struct goodix_ts_data { ...@@ -72,6 +72,9 @@ struct goodix_ts_data {
#define GOODIX_REG_CONFIG_DATA 0x8047 #define GOODIX_REG_CONFIG_DATA 0x8047
#define GOODIX_REG_ID 0x8140 #define GOODIX_REG_ID 0x8140
#define GOODIX_BUFFER_STATUS_READY BIT(7)
#define GOODIX_BUFFER_STATUS_TIMEOUT 20
#define RESOLUTION_LOC 1 #define RESOLUTION_LOC 1
#define MAX_CONTACTS_LOC 5 #define MAX_CONTACTS_LOC 5
#define TRIGGER_LOC 6 #define TRIGGER_LOC 6
...@@ -195,35 +198,53 @@ static int goodix_get_cfg_len(u16 id) ...@@ -195,35 +198,53 @@ static int goodix_get_cfg_len(u16 id)
static int goodix_ts_read_input_report(struct goodix_ts_data *ts, u8 *data) static int goodix_ts_read_input_report(struct goodix_ts_data *ts, u8 *data)
{ {
unsigned long max_timeout;
int touch_num; int touch_num;
int error; int error;
error = goodix_i2c_read(ts->client, GOODIX_READ_COOR_ADDR, data, /*
GOODIX_CONTACT_SIZE + 1); * The 'buffer status' bit, which indicates that the data is valid, is
if (error) { * not set as soon as the interrupt is raised, but slightly after.
dev_err(&ts->client->dev, "I2C transfer error: %d\n", error); * This takes around 10 ms to happen, so we poll for 20 ms.
return error; */
} max_timeout = jiffies + msecs_to_jiffies(GOODIX_BUFFER_STATUS_TIMEOUT);
do {
error = goodix_i2c_read(ts->client, GOODIX_READ_COOR_ADDR,
data, GOODIX_CONTACT_SIZE + 1);
if (error) {
dev_err(&ts->client->dev, "I2C transfer error: %d\n",
error);
return error;
}
if (!(data[0] & 0x80)) if (data[0] & GOODIX_BUFFER_STATUS_READY) {
return -EAGAIN; touch_num = data[0] & 0x0f;
if (touch_num > ts->max_touch_num)
return -EPROTO;
if (touch_num > 1) {
data += 1 + GOODIX_CONTACT_SIZE;
error = goodix_i2c_read(ts->client,
GOODIX_READ_COOR_ADDR +
1 + GOODIX_CONTACT_SIZE,
data,
GOODIX_CONTACT_SIZE *
(touch_num - 1));
if (error)
return error;
}
return touch_num;
}
touch_num = data[0] & 0x0f; usleep_range(1000, 2000); /* Poll every 1 - 2 ms */
if (touch_num > ts->max_touch_num) } while (time_before(jiffies, max_timeout));
return -EPROTO;
if (touch_num > 1) {
data += 1 + GOODIX_CONTACT_SIZE;
error = goodix_i2c_read(ts->client,
GOODIX_READ_COOR_ADDR +
1 + GOODIX_CONTACT_SIZE,
data,
GOODIX_CONTACT_SIZE * (touch_num - 1));
if (error)
return error;
}
return touch_num; /*
* The Goodix panel will send spurious interrupts after a
* 'finger up' event, which will always cause a timeout.
*/
return 0;
} }
static void goodix_ts_report_touch(struct goodix_ts_data *ts, u8 *coor_data) static void goodix_ts_report_touch(struct goodix_ts_data *ts, u8 *coor_data)
......
...@@ -663,12 +663,10 @@ static int stmfts_probe(struct i2c_client *client, ...@@ -663,12 +663,10 @@ static int stmfts_probe(struct i2c_client *client,
sdata->input->open = stmfts_input_open; sdata->input->open = stmfts_input_open;
sdata->input->close = stmfts_input_close; sdata->input->close = stmfts_input_close;
input_set_capability(sdata->input, EV_ABS, ABS_MT_POSITION_X);
input_set_capability(sdata->input, EV_ABS, ABS_MT_POSITION_Y);
touchscreen_parse_properties(sdata->input, true, &sdata->prop); touchscreen_parse_properties(sdata->input, true, &sdata->prop);
input_set_abs_params(sdata->input, ABS_MT_POSITION_X, 0,
sdata->prop.max_x, 0, 0);
input_set_abs_params(sdata->input, ABS_MT_POSITION_Y, 0,
sdata->prop.max_y, 0, 0);
input_set_abs_params(sdata->input, ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0); input_set_abs_params(sdata->input, ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0);
input_set_abs_params(sdata->input, ABS_MT_TOUCH_MINOR, 0, 255, 0, 0); input_set_abs_params(sdata->input, ABS_MT_TOUCH_MINOR, 0, 255, 0, 0);
input_set_abs_params(sdata->input, ABS_MT_ORIENTATION, 0, 255, 0, 0); input_set_abs_params(sdata->input, ABS_MT_ORIENTATION, 0, 255, 0, 0);
......
...@@ -161,7 +161,7 @@ static void titsc_step_config(struct titsc *ts_dev) ...@@ -161,7 +161,7 @@ static void titsc_step_config(struct titsc *ts_dev)
break; break;
case 5: case 5:
config |= ts_dev->bit_xp | STEPCONFIG_INP_AN4 | config |= ts_dev->bit_xp | STEPCONFIG_INP_AN4 |
ts_dev->bit_xn | ts_dev->bit_yp; STEPCONFIG_XNP | STEPCONFIG_YPN;
break; break;
case 8: case 8:
config |= ts_dev->bit_yp | STEPCONFIG_INP(ts_dev->inp_xp); config |= ts_dev->bit_yp | STEPCONFIG_INP(ts_dev->inp_xp);
......
...@@ -234,6 +234,10 @@ struct input_dev { ...@@ -234,6 +234,10 @@ struct input_dev {
#error "SW_MAX and INPUT_DEVICE_ID_SW_MAX do not match" #error "SW_MAX and INPUT_DEVICE_ID_SW_MAX do not match"
#endif #endif
#if INPUT_PROP_MAX != INPUT_DEVICE_ID_PROP_MAX
#error "INPUT_PROP_MAX and INPUT_DEVICE_ID_PROP_MAX do not match"
#endif
#define INPUT_DEVICE_ID_MATCH_DEVICE \ #define INPUT_DEVICE_ID_MATCH_DEVICE \
(INPUT_DEVICE_ID_MATCH_BUS | INPUT_DEVICE_ID_MATCH_VENDOR | INPUT_DEVICE_ID_MATCH_PRODUCT) (INPUT_DEVICE_ID_MATCH_BUS | INPUT_DEVICE_ID_MATCH_VENDOR | INPUT_DEVICE_ID_MATCH_PRODUCT)
#define INPUT_DEVICE_ID_MATCH_DEVICE_AND_VERSION \ #define INPUT_DEVICE_ID_MATCH_DEVICE_AND_VERSION \
...@@ -469,6 +473,9 @@ int input_get_keycode(struct input_dev *dev, struct input_keymap_entry *ke); ...@@ -469,6 +473,9 @@ int input_get_keycode(struct input_dev *dev, struct input_keymap_entry *ke);
int input_set_keycode(struct input_dev *dev, int input_set_keycode(struct input_dev *dev,
const struct input_keymap_entry *ke); const struct input_keymap_entry *ke);
bool input_match_device_id(const struct input_dev *dev,
const struct input_device_id *id);
void input_enable_softrepeat(struct input_dev *dev, int delay, int period); void input_enable_softrepeat(struct input_dev *dev, int delay, int period);
extern struct class input_class; extern struct class input_class;
......
...@@ -293,6 +293,7 @@ struct pcmcia_device_id { ...@@ -293,6 +293,7 @@ struct pcmcia_device_id {
#define INPUT_DEVICE_ID_SND_MAX 0x07 #define INPUT_DEVICE_ID_SND_MAX 0x07
#define INPUT_DEVICE_ID_FF_MAX 0x7f #define INPUT_DEVICE_ID_FF_MAX 0x7f
#define INPUT_DEVICE_ID_SW_MAX 0x0f #define INPUT_DEVICE_ID_SW_MAX 0x0f
#define INPUT_DEVICE_ID_PROP_MAX 0x1f
#define INPUT_DEVICE_ID_MATCH_BUS 1 #define INPUT_DEVICE_ID_MATCH_BUS 1
#define INPUT_DEVICE_ID_MATCH_VENDOR 2 #define INPUT_DEVICE_ID_MATCH_VENDOR 2
...@@ -308,6 +309,7 @@ struct pcmcia_device_id { ...@@ -308,6 +309,7 @@ struct pcmcia_device_id {
#define INPUT_DEVICE_ID_MATCH_SNDBIT 0x0400 #define INPUT_DEVICE_ID_MATCH_SNDBIT 0x0400
#define INPUT_DEVICE_ID_MATCH_FFBIT 0x0800 #define INPUT_DEVICE_ID_MATCH_FFBIT 0x0800
#define INPUT_DEVICE_ID_MATCH_SWBIT 0x1000 #define INPUT_DEVICE_ID_MATCH_SWBIT 0x1000
#define INPUT_DEVICE_ID_MATCH_PROPBIT 0x2000
struct input_device_id { struct input_device_id {
...@@ -327,6 +329,7 @@ struct input_device_id { ...@@ -327,6 +329,7 @@ struct input_device_id {
kernel_ulong_t sndbit[INPUT_DEVICE_ID_SND_MAX / BITS_PER_LONG + 1]; kernel_ulong_t sndbit[INPUT_DEVICE_ID_SND_MAX / BITS_PER_LONG + 1];
kernel_ulong_t ffbit[INPUT_DEVICE_ID_FF_MAX / BITS_PER_LONG + 1]; kernel_ulong_t ffbit[INPUT_DEVICE_ID_FF_MAX / BITS_PER_LONG + 1];
kernel_ulong_t swbit[INPUT_DEVICE_ID_SW_MAX / BITS_PER_LONG + 1]; kernel_ulong_t swbit[INPUT_DEVICE_ID_SW_MAX / BITS_PER_LONG + 1];
kernel_ulong_t propbit[INPUT_DEVICE_ID_PROP_MAX / BITS_PER_LONG + 1];
kernel_ulong_t driver_info; kernel_ulong_t driver_info;
}; };
......
...@@ -105,6 +105,7 @@ int main(void) ...@@ -105,6 +105,7 @@ int main(void)
DEVID_FIELD(input_device_id, sndbit); DEVID_FIELD(input_device_id, sndbit);
DEVID_FIELD(input_device_id, ffbit); DEVID_FIELD(input_device_id, ffbit);
DEVID_FIELD(input_device_id, swbit); DEVID_FIELD(input_device_id, swbit);
DEVID_FIELD(input_device_id, propbit);
DEVID(eisa_device_id); DEVID(eisa_device_id);
DEVID_FIELD(eisa_device_id, sig); DEVID_FIELD(eisa_device_id, sig);
......
...@@ -761,7 +761,7 @@ static void do_input(char *alias, ...@@ -761,7 +761,7 @@ static void do_input(char *alias,
sprintf(alias + strlen(alias), "%X,*", i); sprintf(alias + strlen(alias), "%X,*", i);
} }
/* input:b0v0p0e0-eXkXrXaXmXlXsXfXwX where X is comma-separated %02X. */ /* input:b0v0p0e0-eXkXrXaXmXlXsXfXwXprX where X is comma-separated %02X. */
static int do_input_entry(const char *filename, void *symval, static int do_input_entry(const char *filename, void *symval,
char *alias) char *alias)
{ {
...@@ -779,6 +779,7 @@ static int do_input_entry(const char *filename, void *symval, ...@@ -779,6 +779,7 @@ static int do_input_entry(const char *filename, void *symval,
DEF_FIELD_ADDR(symval, input_device_id, sndbit); DEF_FIELD_ADDR(symval, input_device_id, sndbit);
DEF_FIELD_ADDR(symval, input_device_id, ffbit); DEF_FIELD_ADDR(symval, input_device_id, ffbit);
DEF_FIELD_ADDR(symval, input_device_id, swbit); DEF_FIELD_ADDR(symval, input_device_id, swbit);
DEF_FIELD_ADDR(symval, input_device_id, propbit);
sprintf(alias, "input:"); sprintf(alias, "input:");
...@@ -816,6 +817,9 @@ static int do_input_entry(const char *filename, void *symval, ...@@ -816,6 +817,9 @@ static int do_input_entry(const char *filename, void *symval,
sprintf(alias + strlen(alias), "w*"); sprintf(alias + strlen(alias), "w*");
if (flags & INPUT_DEVICE_ID_MATCH_SWBIT) if (flags & INPUT_DEVICE_ID_MATCH_SWBIT)
do_input(alias, *swbit, 0, INPUT_DEVICE_ID_SW_MAX); do_input(alias, *swbit, 0, INPUT_DEVICE_ID_SW_MAX);
sprintf(alias + strlen(alias), "pr*");
if (flags & INPUT_DEVICE_ID_MATCH_PROPBIT)
do_input(alias, *propbit, 0, INPUT_DEVICE_ID_PROP_MAX);
return 1; return 1;
} }
ADD_TO_DEVTABLE("input", input_device_id, do_input_entry); ADD_TO_DEVTABLE("input", input_device_id, do_input_entry);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册