@@ -787,20 +787,6 @@ static const __u8 *xpadneo_report_fixup(struct hid_device *hdev, __u8 *rdesc, un
787
787
return rdesc ;
788
788
}
789
789
790
- static void xpadneo_toggle_mouse (struct xpadneo_devdata * xdata )
791
- {
792
- if (xdata -> mouse_mode ) {
793
- xdata -> mouse_mode = false;
794
- hid_info (xdata -> hdev , "mouse mode disabled\n" );
795
- } else {
796
- xdata -> mouse_mode = true;
797
- hid_info (xdata -> hdev , "mouse mode enabled\n" );
798
- }
799
-
800
- /* Indicate that a request was made */
801
- xdata -> profile_switched = true;
802
- }
803
-
804
790
static void xpadneo_switch_profile (struct xpadneo_devdata * xdata , const u8 profile ,
805
791
const bool emulated )
806
792
{
@@ -907,6 +893,9 @@ static int xpadneo_raw_event(struct hid_device *hdev, struct hid_report *report,
907
893
}
908
894
}
909
895
896
+ if (xpadneo_mouse_raw_event (xdata , report , data , reportsize ))
897
+ return -1 ;
898
+
910
899
return 0 ;
911
900
}
912
901
@@ -939,6 +928,7 @@ static int xpadneo_input_configured(struct hid_device *hdev, struct hid_input *h
939
928
return 0 ;
940
929
default :
941
930
hid_warn (hdev , "unhandled input application 0x%x\n" , hi -> application );
931
+ return 0 ;
942
932
}
943
933
944
934
if (param_disable_deadzones ) {
@@ -988,6 +978,9 @@ static int xpadneo_event(struct hid_device *hdev, struct hid_field *field,
988
978
struct input_dev * gamepad = xdata -> gamepad ;
989
979
struct input_dev * keyboard = xdata -> keyboard ;
990
980
981
+ if (xpadneo_mouse_event (xdata , usage , value ))
982
+ goto stop_processing ;
983
+
991
984
if ((usage -> type == EV_KEY ) && (usage -> code == BTN_PADDLES (0 ))) {
992
985
if (gamepad && xdata -> profile == 0 ) {
993
986
/* report the paddles individually */
@@ -1306,6 +1299,10 @@ static int xpadneo_probe(struct hid_device *hdev, const struct hid_device_id *id
1306
1299
if (ret )
1307
1300
return ret ;
1308
1301
1302
+ ret = xpadneo_init_mouse (xdata );
1303
+ if (ret )
1304
+ return ret ;
1305
+
1309
1306
ret = xpadneo_init_hw (hdev );
1310
1307
if (ret ) {
1311
1308
hid_err (hdev , "hw init failed: %d\n" , ret );
@@ -1317,6 +1314,9 @@ static int xpadneo_probe(struct hid_device *hdev, const struct hid_device_id *id
1317
1314
if (ret )
1318
1315
hid_err (hdev , "could not initialize ff, continuing anyway\n" );
1319
1316
1317
+ timer_setup (& xdata -> mouse_timer , xpadneo_mouse_report , 0 );
1318
+ mod_timer (& xdata -> mouse_timer , jiffies );
1319
+
1320
1320
hid_info (hdev , "%s connected\n" , xdata -> battery .name );
1321
1321
1322
1322
return 0 ;
@@ -1352,6 +1352,7 @@ static void xpadneo_remove(struct hid_device *hdev)
1352
1352
hdev -> product = xdata -> original_product ;
1353
1353
}
1354
1354
1355
+ del_timer_sync (& xdata -> mouse_timer );
1355
1356
cancel_delayed_work_sync (& xdata -> ff_worker );
1356
1357
1357
1358
kfree (xdata -> battery .name );
0 commit comments