Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
L
linux-next
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Sebastian Krzyszkowiak
linux-next
Commits
07eef72a
Verified
Commit
07eef72a
authored
Jan 06, 2019
by
Sebastian Krzyszkowiak
Committed by
Sebastian Krzyszkowiak
Jan 21, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support feedback configuration via USB
parent
60a578a0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
2 deletions
+25
-2
drivers/hid/hid-magicmouse.c
drivers/hid/hid-magicmouse.c
+25
-2
No files found.
drivers/hid/hid-magicmouse.c
View file @
07eef72a
...
...
@@ -16,7 +16,9 @@
#include <linux/input/mt.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/usb/input.h>
#include "usbhid/usbhid.h"
#include "hid-ids.h"
static
bool
emulate_3button
=
true
;
...
...
@@ -422,6 +424,7 @@ static int magicmouse_setup_feedback(struct hid_device *hdev,
const
u8
mt2_click
[]
=
{
0xF2
,
0x22
,
0x01
,
0x00
,
0x78
,
0x02
,
0x00
,
0x24
,
0x30
,
0x06
,
0x01
,
0x00
,
0x18
,
0x48
,
0x13
};
const
u8
mt2_release
[]
=
{
0xF2
,
0x23
,
0x01
,
0x00
,
0x78
,
0x02
,
0x00
,
0x24
,
0x30
,
0x06
,
0x01
,
0x00
,
0x18
,
0x48
,
0x13
};
struct
usb_device
*
usb
;
u8
*
buf
;
if
(
id
->
product
==
USB_DEVICE_ID_APPLE_MAGICTRACKPAD2
)
{
...
...
@@ -448,8 +451,28 @@ static int magicmouse_setup_feedback(struct hid_device *hdev,
HID_FEATURE_REPORT
,
HID_REQ_SET_REPORT
);
kfree
(
buf
);
}
else
{
/* USB_VENDOR_ID_APPLE */
// TODO: should send the same messages as via bluetooth, but without the first byte (0xF2)
// and not via HID, but via URB_CONTROL
usb
=
hid_to_usb_dev
(
hdev
);
buf
=
kmemdup
(
mt2_click
+
1
,
sizeof
(
mt2_click
)
-
sizeof
(
mt2_click
[
0
]),
GFP_KERNEL
);
if
(
!
buf
)
{
return
-
ENOMEM
;
}
buf
[
2
]
=
(
u8
)(
feedback_click
>>
0
);
buf
[
5
]
=
(
u8
)(
feedback_click
>>
8
);
buf
[
10
]
=
(
u8
)(
feedback_click
>>
16
);
usb_control_msg
(
usb
,
usb_sndctrlpipe
(
usb
,
0
),
9
,
0x21
,
0x0322
,
2
,
buf
,
sizeof
(
mt2_click
)
-
sizeof
(
mt2_click
[
0
]),
USB_CTRL_SET_TIMEOUT
);
kfree
(
buf
);
buf
=
kmemdup
(
mt2_release
+
1
,
sizeof
(
mt2_release
)
-
sizeof
(
mt2_release
[
0
]),
GFP_KERNEL
);
if
(
!
buf
)
{
return
-
ENOMEM
;
}
buf
[
2
]
=
(
u8
)(
feedback_release
>>
0
);
buf
[
5
]
=
(
u8
)(
feedback_release
>>
8
);
buf
[
10
]
=
(
u8
)(
feedback_release
>>
16
);
usb_control_msg
(
usb
,
usb_sndctrlpipe
(
usb
,
0
),
9
,
0x21
,
0x0323
,
2
,
buf
,
sizeof
(
mt2_release
)
-
sizeof
(
mt2_release
[
0
]),
USB_CTRL_SET_TIMEOUT
);
kfree
(
buf
);
}
}
return
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment