Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
a9b6e357
Commit
a9b6e357
authored
Jan 16, 2004
by
Thomas Stewart
Committed by
Greg Kroah-Hartman
Jan 16, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] USB: powermate-payload-size-fix.patch
Thomas has a newer variant of this device, which sends more data.
parent
ef6b3f4f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
7 deletions
+13
-7
drivers/usb/input/powermate.c
drivers/usb/input/powermate.c
+13
-7
No files found.
drivers/usb/input/powermate.c
View file @
a9b6e357
...
@@ -54,7 +54,11 @@
...
@@ -54,7 +54,11 @@
#define UPDATE_PULSE_AWAKE (1<<2)
#define UPDATE_PULSE_AWAKE (1<<2)
#define UPDATE_PULSE_MODE (1<<3)
#define UPDATE_PULSE_MODE (1<<3)
#define POWERMATE_PAYLOAD_SIZE 3
/* at least two versions of the hardware exist, with differing payload
sizes. the first three bytes always contain the "interesting" data in
the relevant format. */
#define POWERMATE_PAYLOAD_SIZE_MAX 6
#define POWERMATE_PAYLOAD_SIZE_MIN 3
struct
powermate_device
{
struct
powermate_device
{
signed
char
*
data
;
signed
char
*
data
;
dma_addr_t
data_dma
;
dma_addr_t
data_dma
;
...
@@ -269,7 +273,7 @@ static int powermate_input_event(struct input_dev *dev, unsigned int type, unsig
...
@@ -269,7 +273,7 @@ static int powermate_input_event(struct input_dev *dev, unsigned int type, unsig
static
int
powermate_alloc_buffers
(
struct
usb_device
*
udev
,
struct
powermate_device
*
pm
)
static
int
powermate_alloc_buffers
(
struct
usb_device
*
udev
,
struct
powermate_device
*
pm
)
{
{
pm
->
data
=
usb_buffer_alloc
(
udev
,
POWERMATE_PAYLOAD_SIZE
,
pm
->
data
=
usb_buffer_alloc
(
udev
,
POWERMATE_PAYLOAD_SIZE
_MAX
,
SLAB_ATOMIC
,
&
pm
->
data_dma
);
SLAB_ATOMIC
,
&
pm
->
data_dma
);
if
(
!
pm
->
data
)
if
(
!
pm
->
data
)
return
-
1
;
return
-
1
;
...
@@ -284,7 +288,7 @@ static int powermate_alloc_buffers(struct usb_device *udev, struct powermate_dev
...
@@ -284,7 +288,7 @@ static int powermate_alloc_buffers(struct usb_device *udev, struct powermate_dev
static
void
powermate_free_buffers
(
struct
usb_device
*
udev
,
struct
powermate_device
*
pm
)
static
void
powermate_free_buffers
(
struct
usb_device
*
udev
,
struct
powermate_device
*
pm
)
{
{
if
(
pm
->
data
)
if
(
pm
->
data
)
usb_buffer_free
(
udev
,
POWERMATE_PAYLOAD_SIZE
,
usb_buffer_free
(
udev
,
POWERMATE_PAYLOAD_SIZE
_MAX
,
pm
->
data
,
pm
->
data_dma
);
pm
->
data
,
pm
->
data_dma
);
if
(
pm
->
configcr
)
if
(
pm
->
configcr
)
usb_buffer_free
(
udev
,
sizeof
(
*
(
pm
->
configcr
)),
usb_buffer_free
(
udev
,
sizeof
(
*
(
pm
->
configcr
)),
...
@@ -347,12 +351,14 @@ static int powermate_probe(struct usb_interface *intf, const struct usb_device_i
...
@@ -347,12 +351,14 @@ static int powermate_probe(struct usb_interface *intf, const struct usb_device_i
pipe
=
usb_rcvintpipe
(
udev
,
endpoint
->
bEndpointAddress
);
pipe
=
usb_rcvintpipe
(
udev
,
endpoint
->
bEndpointAddress
);
maxp
=
usb_maxpacket
(
udev
,
pipe
,
usb_pipeout
(
pipe
));
maxp
=
usb_maxpacket
(
udev
,
pipe
,
usb_pipeout
(
pipe
));
if
(
maxp
!=
POWERMATE_PAYLOAD_SIZE
)
if
(
maxp
<
POWERMATE_PAYLOAD_SIZE_MIN
||
maxp
>
POWERMATE_PAYLOAD_SIZE_MAX
){
printk
(
"powermate: Expected payload of %d bytes, found %d bytes!
\n
"
,
POWERMATE_PAYLOAD_SIZE
,
maxp
);
printk
(
"powermate: Expected payload of %d--%d bytes, found %d bytes!
\n
"
,
POWERMATE_PAYLOAD_SIZE_MIN
,
POWERMATE_PAYLOAD_SIZE_MAX
,
maxp
);
maxp
=
POWERMATE_PAYLOAD_SIZE_MAX
;
}
usb_fill_int_urb
(
pm
->
irq
,
udev
,
pipe
,
pm
->
data
,
usb_fill_int_urb
(
pm
->
irq
,
udev
,
pipe
,
pm
->
data
,
POWERMATE_PAYLOAD_SIZE
,
powermate_irq
,
maxp
,
powermate_irq
,
pm
,
endpoint
->
bInterval
);
pm
,
endpoint
->
bInterval
);
pm
->
irq
->
transfer_dma
=
pm
->
data_dma
;
pm
->
irq
->
transfer_dma
=
pm
->
data_dma
;
pm
->
irq
->
transfer_flags
|=
URB_NO_TRANSFER_DMA_MAP
;
pm
->
irq
->
transfer_flags
|=
URB_NO_TRANSFER_DMA_MAP
;
...
...
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