diff options
Diffstat (limited to 'drivers/input/joydev.c')
-rw-r--r-- | drivers/input/joydev.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c index b1bd6dd32286..c52bec4d0530 100644 --- a/drivers/input/joydev.c +++ b/drivers/input/joydev.c | |||
@@ -286,6 +286,8 @@ static int joydev_open(struct inode *inode, struct file *file) | |||
286 | goto err_free_client; | 286 | goto err_free_client; |
287 | 287 | ||
288 | file->private_data = client; | 288 | file->private_data = client; |
289 | nonseekable_open(inode, file); | ||
290 | |||
289 | return 0; | 291 | return 0; |
290 | 292 | ||
291 | err_free_client: | 293 | err_free_client: |
@@ -775,6 +777,20 @@ static void joydev_cleanup(struct joydev *joydev) | |||
775 | input_close_device(handle); | 777 | input_close_device(handle); |
776 | } | 778 | } |
777 | 779 | ||
780 | |||
781 | static bool joydev_match(struct input_handler *handler, struct input_dev *dev) | ||
782 | { | ||
783 | /* Avoid touchpads and touchscreens */ | ||
784 | if (test_bit(EV_KEY, dev->evbit) && test_bit(BTN_TOUCH, dev->keybit)) | ||
785 | return false; | ||
786 | |||
787 | /* Avoid tablets, digitisers and similar devices */ | ||
788 | if (test_bit(EV_KEY, dev->evbit) && test_bit(BTN_DIGI, dev->keybit)) | ||
789 | return false; | ||
790 | |||
791 | return true; | ||
792 | } | ||
793 | |||
778 | static int joydev_connect(struct input_handler *handler, struct input_dev *dev, | 794 | static int joydev_connect(struct input_handler *handler, struct input_dev *dev, |
779 | const struct input_device_id *id) | 795 | const struct input_device_id *id) |
780 | { | 796 | { |
@@ -894,22 +910,6 @@ static void joydev_disconnect(struct input_handle *handle) | |||
894 | put_device(&joydev->dev); | 910 | put_device(&joydev->dev); |
895 | } | 911 | } |
896 | 912 | ||
897 | static const struct input_device_id joydev_blacklist[] = { | ||
898 | { | ||
899 | .flags = INPUT_DEVICE_ID_MATCH_EVBIT | | ||
900 | INPUT_DEVICE_ID_MATCH_KEYBIT, | ||
901 | .evbit = { BIT_MASK(EV_KEY) }, | ||
902 | .keybit = { [BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH) }, | ||
903 | }, /* Avoid itouchpads and touchscreens */ | ||
904 | { | ||
905 | .flags = INPUT_DEVICE_ID_MATCH_EVBIT | | ||
906 | INPUT_DEVICE_ID_MATCH_KEYBIT, | ||
907 | .evbit = { BIT_MASK(EV_KEY) }, | ||
908 | .keybit = { [BIT_WORD(BTN_DIGI)] = BIT_MASK(BTN_DIGI) }, | ||
909 | }, /* Avoid tablets, digitisers and similar devices */ | ||
910 | { } /* Terminating entry */ | ||
911 | }; | ||
912 | |||
913 | static const struct input_device_id joydev_ids[] = { | 913 | static const struct input_device_id joydev_ids[] = { |
914 | { | 914 | { |
915 | .flags = INPUT_DEVICE_ID_MATCH_EVBIT | | 915 | .flags = INPUT_DEVICE_ID_MATCH_EVBIT | |
@@ -936,13 +936,13 @@ MODULE_DEVICE_TABLE(input, joydev_ids); | |||
936 | 936 | ||
937 | static struct input_handler joydev_handler = { | 937 | static struct input_handler joydev_handler = { |
938 | .event = joydev_event, | 938 | .event = joydev_event, |
939 | .match = joydev_match, | ||
939 | .connect = joydev_connect, | 940 | .connect = joydev_connect, |
940 | .disconnect = joydev_disconnect, | 941 | .disconnect = joydev_disconnect, |
941 | .fops = &joydev_fops, | 942 | .fops = &joydev_fops, |
942 | .minor = JOYDEV_MINOR_BASE, | 943 | .minor = JOYDEV_MINOR_BASE, |
943 | .name = "joydev", | 944 | .name = "joydev", |
944 | .id_table = joydev_ids, | 945 | .id_table = joydev_ids, |
945 | .blacklist = joydev_blacklist, | ||
946 | }; | 946 | }; |
947 | 947 | ||
948 | static int __init joydev_init(void) | 948 | static int __init joydev_init(void) |