lisa-m/usb_cdcacm: Coding-style/whitespace fixes.

This commit is contained in:
Uwe Hermann 2011-11-12 10:17:31 +01:00
parent f23d9d07b7
commit b1819507b7

View File

@ -40,9 +40,11 @@ static const struct usb_device_descriptor dev = {
.bNumConfigurations = 1, .bNumConfigurations = 1,
}; };
/* This notification endpoint isn't implemented. According to CDC spec its /*
* optional, but its absence causes a NULL pointer dereference in Linux cdc_acm * This notification endpoint isn't implemented. According to CDC spec it's
* driver. */ * optional, but its absence causes a NULL pointer dereference in the
* Linux cdc_acm driver.
*/
static const struct usb_endpoint_descriptor comm_endp[] = {{ static const struct usb_endpoint_descriptor comm_endp[] = {{
.bLength = USB_DT_ENDPOINT_SIZE, .bLength = USB_DT_ENDPOINT_SIZE,
.bDescriptorType = USB_DT_ENDPOINT, .bDescriptorType = USB_DT_ENDPOINT,
@ -159,7 +161,7 @@ static const char *usb_strings[] = {
"x", "x",
"Black Sphere Technologies", "Black Sphere Technologies",
"CDC-ACM Demo", "CDC-ACM Demo",
"DEMO" "DEMO",
}; };
static int cdcacm_control_request(struct usb_setup_data *req, u8 **buf, static int cdcacm_control_request(struct usb_setup_data *req, u8 **buf,
@ -170,13 +172,15 @@ static int cdcacm_control_request(struct usb_setup_data *req, u8 **buf,
switch(req->bRequest) { switch(req->bRequest) {
case USB_CDC_REQ_SET_CONTROL_LINE_STATE: { case USB_CDC_REQ_SET_CONTROL_LINE_STATE: {
/* This Linux cdc_acm driver requires this to be implemented /*
* This Linux cdc_acm driver requires this to be implemented
* even though it's optional in the CDC spec, and we don't * even though it's optional in the CDC spec, and we don't
* advertise it in the ACM functional descriptor. */ * advertise it in the ACM functional descriptor.
*/
char buf[10]; char buf[10];
struct usb_cdc_notification *notif = (void*)buf; struct usb_cdc_notification *notif = (void*)buf;
/* We echo signals back to host as notification */ /* We echo signals back to host as notification. */
notif->bmRequestType = 0xA1; notif->bmRequestType = 0xA1;
notif->bNotification = USB_CDC_NOTIFY_SERIAL_STATE; notif->bNotification = USB_CDC_NOTIFY_SERIAL_STATE;
notif->wValue = 0; notif->wValue = 0;
@ -184,11 +188,11 @@ static int cdcacm_control_request(struct usb_setup_data *req, u8 **buf,
notif->wLength = 2; notif->wLength = 2;
buf[8] = req->wValue & 3; buf[8] = req->wValue & 3;
buf[9] = 0; buf[9] = 0;
//usbd_ep_write_packet(0x83, buf, 10); // usbd_ep_write_packet(0x83, buf, 10);
return 1; return 1;
} }
case USB_CDC_REQ_SET_LINE_CODING: case USB_CDC_REQ_SET_LINE_CODING:
if(*len < sizeof(struct usb_cdc_line_coding)) if (*len < sizeof(struct usb_cdc_line_coding))
return 0; return 0;
return 1; return 1;
@ -202,8 +206,10 @@ static void cdcacm_data_rx_cb(u8 ep)
char buf[64]; char buf[64];
int len = usbd_ep_read_packet(0x01, buf, 64); int len = usbd_ep_read_packet(0x01, buf, 64);
if(len) {
while(usbd_ep_write_packet(0x82, buf, len) == 0); if (len) {
while (usbd_ep_write_packet(0x82, buf, len) == 0)
;
buf[len] = 0; buf[len] = 0;
} }