21 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
23 #define MODULE_NAME "benq"
27 MODULE_AUTHOR(
"Jean-Francois Moine <http://moinejf.free.fr>");
39 .sizeimage = 320 * 240 * 3 / 8 + 590,
43 static void sd_isoc_irq(
struct urb *
urb);
49 struct usb_device *
dev = gspca_dev->
dev;
63 pr_err(
"reg_w err %d\n", ret);
69 static int sd_config(
struct gspca_dev *gspca_dev,
72 gspca_dev->
cam.cam_mode = vga_mode;
74 gspca_dev->
cam.no_urb_create = 1;
79 static int sd_init(
struct gspca_dev *gspca_dev)
85 static int sd_start(
struct gspca_dev *gspca_dev)
92 #error "Not enough URBs in the gspca table"
96 for (n = 0; n < 4; n++) {
99 pr_err(
"usb_alloc_urb failed\n");
108 if (urb->transfer_buffer ==
NULL) {
109 pr_err(
"usb_alloc_coherent failed\n");
112 urb->dev = gspca_dev->
dev;
113 urb->context = gspca_dev;
115 urb->pipe = usb_rcvisocpipe(gspca_dev->
dev,
116 n & 1 ? 0x82 : 0x83);
117 urb->transfer_flags = URB_ISO_ASAP
118 | URB_NO_TRANSFER_DMA_MAP;
120 urb->complete = sd_isoc_irq;
121 urb->number_of_packets = SD_NPKT;
122 for (i = 0; i < SD_NPKT; i++) {
131 static void sd_stopN(
struct gspca_dev *gspca_dev)
135 reg_w(gspca_dev, 0x003c, 0x0003);
136 reg_w(gspca_dev, 0x003c, 0x0004);
137 reg_w(gspca_dev, 0x003c, 0x0005);
138 reg_w(gspca_dev, 0x003c, 0x0006);
139 reg_w(gspca_dev, 0x003c, 0x0007);
143 intf->num_altsetting - 1);
146 static void sd_pkt_scan(
struct gspca_dev *gspca_dev,
154 static void sd_isoc_irq(
struct urb *urb)
156 struct gspca_dev *gspca_dev = (
struct gspca_dev *) urb->context;
161 PDEBUG(D_PACK,
"sd isoc irq");
164 if (urb->status != 0) {
168 if (gspca_dev->frozen)
171 pr_err(
"urb status: %d\n", urb->status);
176 if (urb == gspca_dev->
urb[0] || urb == gspca_dev->
urb[2])
180 if (urb == gspca_dev->
urb[1])
181 urb0 = gspca_dev->
urb[0];
183 urb0 = gspca_dev->
urb[2];
184 for (i = 0; i < urb->number_of_packets; i++) {
187 if (urb0->iso_frame_desc[i].actual_length != SD_PKT_SZ
188 || urb->iso_frame_desc[i].actual_length != SD_PKT_SZ) {
190 urb0->iso_frame_desc[i].actual_length,
191 urb->iso_frame_desc[i].actual_length);
195 st = urb0->iso_frame_desc[
i].status;
197 st = urb->iso_frame_desc[
i].status;
199 pr_err(
"ISOC data error: [%d] status=%d\n",
221 data = (
u8 *) urb0->transfer_buffer
222 + urb0->iso_frame_desc[i].offset;
223 if (
data[0] == 0x80 && (
data[1] & 0xfe) == 0xba) {
229 data + 4, SD_PKT_SZ - 4);
230 }
else if (
data[0] == 0x04 && (
data[1] & 0xfe) == 0xba) {
232 data + 4, SD_PKT_SZ - 4);
237 data = (
u8 *) urb->transfer_buffer
238 + urb->iso_frame_desc[i].offset;
246 pr_err(
"usb_submit_urb(0) ret %d\n",
st);
249 pr_err(
"usb_submit_urb() ret %d\n",
st);
259 .pkt_scan = sd_pkt_scan,
264 {USB_DEVICE(0x04a5, 0x3035)},
277 static struct usb_driver sd_driver = {
279 .id_table = device_table,
283 .suspend = gspca_suspend,
284 .resume = gspca_resume,
285 .reset_resume = gspca_resume,