diff options
author | Jean-Francois Moine <moinejf@free.fr> | 2008-07-03 10:09:12 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-07-20 06:16:41 -0400 |
commit | bf7f0b98426b54c29ec8100a3f1963114c2f2ef0 (patch) | |
tree | c3d43d2240020fded85674066fd2cb7a5a503f86 /drivers/media/video/gspca/pac7311.c | |
parent | 0d2a722ddae5e736a5c36a1b99ee4ca59a8373bc (diff) |
V4L/DVB (8193): gspca: Input buffer may be changed on reg write.
Done for conex, etoms, pac7311, sonixj, t613 and tv8532.
Code cleanup for some other subdrivers.
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/gspca/pac7311.c')
-rw-r--r-- | drivers/media/video/gspca/pac7311.c | 63 |
1 files changed, 35 insertions, 28 deletions
diff --git a/drivers/media/video/gspca/pac7311.c b/drivers/media/video/gspca/pac7311.c index 14eb25d81848..14cc49a4c2cc 100644 --- a/drivers/media/video/gspca/pac7311.c +++ b/drivers/media/video/gspca/pac7311.c | |||
@@ -23,8 +23,8 @@ | |||
23 | 23 | ||
24 | #include "gspca.h" | 24 | #include "gspca.h" |
25 | 25 | ||
26 | #define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0) | 26 | #define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 3) |
27 | static const char version[] = "2.1.0"; | 27 | static const char version[] = "2.1.3"; |
28 | 28 | ||
29 | MODULE_AUTHOR("Thomas Kaiser thomas@kaiser-linux.li"); | 29 | MODULE_AUTHOR("Thomas Kaiser thomas@kaiser-linux.li"); |
30 | MODULE_DESCRIPTION("Pixart PAC7311"); | 30 | MODULE_DESCRIPTION("Pixart PAC7311"); |
@@ -195,16 +195,18 @@ const unsigned char pac7311_jpeg_header[] = { | |||
195 | }; | 195 | }; |
196 | 196 | ||
197 | static void reg_w(struct usb_device *dev, | 197 | static void reg_w(struct usb_device *dev, |
198 | __u16 req, | ||
199 | __u16 value, | ||
200 | __u16 index, | 198 | __u16 index, |
201 | __u8 *buffer, __u16 length) | 199 | char *buffer, __u16 len) |
202 | { | 200 | { |
201 | __u8 tmpbuf[8]; | ||
202 | |||
203 | memcpy(tmpbuf, buffer, len); | ||
203 | usb_control_msg(dev, | 204 | usb_control_msg(dev, |
204 | usb_sndctrlpipe(dev, 0), | 205 | usb_sndctrlpipe(dev, 0), |
205 | req, | 206 | 1, /* request */ |
206 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | 207 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
207 | value, index, buffer, length, | 208 | 0, /* value */ |
209 | index, tmpbuf, len, | ||
208 | 500); | 210 | 500); |
209 | } | 211 | } |
210 | 212 | ||
@@ -227,7 +229,12 @@ static void pac7311_reg_write(struct usb_device *dev, | |||
227 | __u8 buf; | 229 | __u8 buf; |
228 | 230 | ||
229 | buf = value; | 231 | buf = value; |
230 | reg_w(dev, 0x00, value, index, &buf, 1); | 232 | usb_control_msg(dev, |
233 | usb_sndctrlpipe(dev, 0), | ||
234 | 0, /* request */ | ||
235 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | ||
236 | value, index, &buf, 1, | ||
237 | 500); | ||
231 | } | 238 | } |
232 | 239 | ||
233 | /* this function is called at probe time */ | 240 | /* this function is called at probe time */ |
@@ -313,26 +320,26 @@ static void sd_start(struct gspca_dev *gspca_dev) | |||
313 | struct sd *sd = (struct sd *) gspca_dev; | 320 | struct sd *sd = (struct sd *) gspca_dev; |
314 | 321 | ||
315 | pac7311_reg_write(dev, 0xff, 0x01); | 322 | pac7311_reg_write(dev, 0xff, 0x01); |
316 | reg_w(dev, 0x01, 0, 0x0002, "\x48\x0a\x40\x08\x00\x00\x08\x00", 8); | 323 | reg_w(dev, 0x0002, "\x48\x0a\x40\x08\x00\x00\x08\x00", 8); |
317 | reg_w(dev, 0x01, 0, 0x000a, "\x06\xff\x11\xff\x5a\x30\x90\x4c", 8); | 324 | reg_w(dev, 0x000a, "\x06\xff\x11\xff\x5a\x30\x90\x4c", 8); |
318 | reg_w(dev, 0x01, 0, 0x0012, "\x00\x07\x00\x0a\x10\x00\xa0\x10", 8); | 325 | reg_w(dev, 0x0012, "\x00\x07\x00\x0a\x10\x00\xa0\x10", 8); |
319 | reg_w(dev, 0x01, 0, 0x001a, "\x02\x00\x00\x00\x00\x0b\x01\x00", 8); | 326 | reg_w(dev, 0x001a, "\x02\x00\x00\x00\x00\x0b\x01\x00", 8); |
320 | reg_w(dev, 0x01, 0, 0x0022, "\x00\x00\x00\x00\x00\x00\x00\x00", 8); | 327 | reg_w(dev, 0x0022, "\x00\x00\x00\x00\x00\x00\x00\x00", 8); |
321 | reg_w(dev, 0x01, 0, 0x002a, "\x00\x00\x00", 3); | 328 | reg_w(dev, 0x002a, "\x00\x00\x00", 3); |
322 | reg_w(dev, 0x01, 0, 0x003e, "\x00\x00\x78\x52\x4a\x52\x78\x6e", 8); | 329 | reg_w(dev, 0x003e, "\x00\x00\x78\x52\x4a\x52\x78\x6e", 8); |
323 | reg_w(dev, 0x01, 0, 0x0046, "\x48\x46\x48\x6e\x5f\x49\x42\x49", 8); | 330 | reg_w(dev, 0x0046, "\x48\x46\x48\x6e\x5f\x49\x42\x49", 8); |
324 | reg_w(dev, 0x01, 0, 0x004e, "\x5f\x5f\x49\x42\x49\x5f\x6e\x48", 8); | 331 | reg_w(dev, 0x004e, "\x5f\x5f\x49\x42\x49\x5f\x6e\x48", 8); |
325 | reg_w(dev, 0x01, 0, 0x0056, "\x46\x48\x6e\x78\x52\x4a\x52\x78", 8); | 332 | reg_w(dev, 0x0056, "\x46\x48\x6e\x78\x52\x4a\x52\x78", 8); |
326 | reg_w(dev, 0x01, 0, 0x005e, "\x00\x00\x09\x1b\x34\x49\x5c\x9b", 8); | 333 | reg_w(dev, 0x005e, "\x00\x00\x09\x1b\x34\x49\x5c\x9b", 8); |
327 | reg_w(dev, 0x01, 0, 0x0066, "\xd0\xff", 2); | 334 | reg_w(dev, 0x0066, "\xd0\xff", 2); |
328 | reg_w(dev, 0x01, 0, 0x0078, "\x44\x00\xf2\x01\x01\x80", 6); | 335 | reg_w(dev, 0x0078, "\x44\x00\xf2\x01\x01\x80", 6); |
329 | reg_w(dev, 0x01, 0, 0x007f, "\x2a\x1c\x00\xc8\x02\x58\x03\x84", 8); | 336 | reg_w(dev, 0x007f, "\x2a\x1c\x00\xc8\x02\x58\x03\x84", 8); |
330 | reg_w(dev, 0x01, 0, 0x0087, "\x12\x00\x1a\x04\x08\x0c\x10\x14", 8); | 337 | reg_w(dev, 0x0087, "\x12\x00\x1a\x04\x08\x0c\x10\x14", 8); |
331 | reg_w(dev, 0x01, 0, 0x008f, "\x18\x20", 2); | 338 | reg_w(dev, 0x008f, "\x18\x20", 2); |
332 | reg_w(dev, 0x01, 0, 0x0096, "\x01\x08\x04", 3); | 339 | reg_w(dev, 0x0096, "\x01\x08\x04", 3); |
333 | reg_w(dev, 0x01, 0, 0x00a0, "\x44\x44\x44\x04", 4); | 340 | reg_w(dev, 0x00a0, "\x44\x44\x44\x04", 4); |
334 | reg_w(dev, 0x01, 0, 0x00f0, "\x01\x00\x00\x00\x22\x00\x20\x00", 8); | 341 | reg_w(dev, 0x00f0, "\x01\x00\x00\x00\x22\x00\x20\x00", 8); |
335 | reg_w(dev, 0x01, 0, 0x00f8, "\x3f\x00\x0a\x01\x00", 5); | 342 | reg_w(dev, 0x00f8, "\x3f\x00\x0a\x01\x00", 5); |
336 | 343 | ||
337 | pac7311_reg_write(dev, 0xff, 0x04); | 344 | pac7311_reg_write(dev, 0xff, 0x04); |
338 | pac7311_reg_write(dev, 0x02, 0x04); | 345 | pac7311_reg_write(dev, 0x02, 0x04); |