Input: allow matching device IDs on property bits
Let's allow matching input devices on their property bits, both in-kernel and when generating module aliases. Tested-by: Roderick Colenbrander <roderick.colenbrander@sony.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
This commit is contained in:
parent
55dfce873d
commit
8724ecb072
@ -960,7 +960,8 @@ bool input_match_device_id(const struct input_dev *dev,
|
|||||||
!bitmap_subset(id->ledbit, dev->ledbit, LED_MAX) ||
|
!bitmap_subset(id->ledbit, dev->ledbit, LED_MAX) ||
|
||||||
!bitmap_subset(id->sndbit, dev->sndbit, SND_MAX) ||
|
!bitmap_subset(id->sndbit, dev->sndbit, SND_MAX) ||
|
||||||
!bitmap_subset(id->ffbit, dev->ffbit, FF_MAX) ||
|
!bitmap_subset(id->ffbit, dev->ffbit, FF_MAX) ||
|
||||||
!bitmap_subset(id->swbit, dev->swbit, SW_MAX)) {
|
!bitmap_subset(id->swbit, dev->swbit, SW_MAX) ||
|
||||||
|
!bitmap_subset(id->propbit, dev->propbit, INPUT_PROP_MAX)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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 \
|
||||||
|
@ -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 {
|
|||||||
#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 {
|
|||||||
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)
|
|||||||
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,
|
|||||||
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,
|
|||||||
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,
|
|||||||
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);
|
||||||
|
Loading…
Reference in New Issue
Block a user