usb-skeleton.c (1da177e4c3f41524e886b7f1b8a0c1fc7321cac2) usb-skeleton.c (6b216df87cb5f3bb7d47a33f1cd955ebc7b84dfd)
1/*
2 * USB Skeleton driver - 2.0
3 *
4 * Copyright (C) 2001-2004 Greg Kroah-Hartman (greg@kroah.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation, version 2.

--- 243 unchanged lines hidden (view full) ---

252
253 /* set up the endpoint information */
254 /* use only the first bulk-in and bulk-out endpoints */
255 iface_desc = interface->cur_altsetting;
256 for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
257 endpoint = &iface_desc->endpoint[i].desc;
258
259 if (!dev->bulk_in_endpointAddr &&
1/*
2 * USB Skeleton driver - 2.0
3 *
4 * Copyright (C) 2001-2004 Greg Kroah-Hartman (greg@kroah.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation, version 2.

--- 243 unchanged lines hidden (view full) ---

252
253 /* set up the endpoint information */
254 /* use only the first bulk-in and bulk-out endpoints */
255 iface_desc = interface->cur_altsetting;
256 for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
257 endpoint = &iface_desc->endpoint[i].desc;
258
259 if (!dev->bulk_in_endpointAddr &&
260 (endpoint->bEndpointAddress & USB_DIR_IN) &&
260 ((endpoint->bEndpointAddress & USB_ENDPOINT_DIR_MASK)
261 == USB_DIR_IN) &&
261 ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)
262 == USB_ENDPOINT_XFER_BULK)) {
263 /* we found a bulk in endpoint */
264 buffer_size = le16_to_cpu(endpoint->wMaxPacketSize);
265 dev->bulk_in_size = buffer_size;
266 dev->bulk_in_endpointAddr = endpoint->bEndpointAddress;
267 dev->bulk_in_buffer = kmalloc(buffer_size, GFP_KERNEL);
268 if (!dev->bulk_in_buffer) {
269 err("Could not allocate bulk_in_buffer");
270 goto error;
271 }
272 }
273
274 if (!dev->bulk_out_endpointAddr &&
262 ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)
263 == USB_ENDPOINT_XFER_BULK)) {
264 /* we found a bulk in endpoint */
265 buffer_size = le16_to_cpu(endpoint->wMaxPacketSize);
266 dev->bulk_in_size = buffer_size;
267 dev->bulk_in_endpointAddr = endpoint->bEndpointAddress;
268 dev->bulk_in_buffer = kmalloc(buffer_size, GFP_KERNEL);
269 if (!dev->bulk_in_buffer) {
270 err("Could not allocate bulk_in_buffer");
271 goto error;
272 }
273 }
274
275 if (!dev->bulk_out_endpointAddr &&
275 !(endpoint->bEndpointAddress & USB_DIR_OUT) &&
276 ((endpoint->bEndpointAddress & USB_ENDPOINT_DIR_MASK)
277 == USB_DIR_OUT) &&
276 ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)
277 == USB_ENDPOINT_XFER_BULK)) {
278 /* we found a bulk out endpoint */
279 dev->bulk_out_endpointAddr = endpoint->bEndpointAddress;
280 }
281 }
282 if (!(dev->bulk_in_endpointAddr && dev->bulk_out_endpointAddr)) {
283 err("Could not find both bulk-in and bulk-out endpoints");

--- 77 unchanged lines hidden ---
278 ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)
279 == USB_ENDPOINT_XFER_BULK)) {
280 /* we found a bulk out endpoint */
281 dev->bulk_out_endpointAddr = endpoint->bEndpointAddress;
282 }
283 }
284 if (!(dev->bulk_in_endpointAddr && dev->bulk_out_endpointAddr)) {
285 err("Could not find both bulk-in and bulk-out endpoints");

--- 77 unchanged lines hidden ---