Re: [PATCH] hid2hci add CSR 8510 A10 support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Gordon,

A few more coding style suggestions below.

On Sat, Mar 29, 2014 at 7:37 AM, Gordon <kernel@xxxxxxxxxx> wrote:
> diff --git a/tools/hid2hci.c b/tools/hid2hci.c
> index 2dbfca7..1f64b41 100644
> --- a/tools/hid2hci.c
> +++ b/tools/hid2hci.c
> @@ -119,6 +119,49 @@ static int usb_switch_csr(int fd, enum mode mode)
>         return err;
>  }
>
> +static int usb_switch_csr2(int fd, enum mode mode)
> +{
> +       int err;
> +       struct usbfs_disconnect disconnect;
> +       uint8_t report[] = {
> +               0x01, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
> +       };

Add an empty line here to separate variable declarations.

> +       switch (mode) {
> +       case HCI:
> +               /* send report as is */
> +               disconnect.interface = 0;
> +               disconnect.flags = USBFS_DISCONNECT_EXCEPT_DRIVER;
> +               strcpy(disconnect.driver, "usbfs");
> +
> +               if (ioctl(fd, USBFS_IOCTL_DISCONNECT, &disconnect) < 0) {
> +                       fprintf(stderr, "Can't claim interface: %s (%d)\n",
> +                               strerror(errno), errno);
> +                       return -1;
> +               }

Add an empty line here.

> +               /* Set_report request with
> +                * report id: 0x01, report type: feature (0x03)
> +                * on interface 0
> +                */
> +               err = control_message(fd,
> +                                     USB_ENDPOINT_OUT | USB_TYPE_CLASS |
> +                                     USB_RECIP_INTERFACE,
> +                                     USB_REQ_SET_CONFIGURATION,
> +                                     0x01 | (0x03 << 8),
> +                                     0, report, sizeof(report), 5000);
> +               /* unable to detect whether the previous state
> +                * already was HCI (EALREADY)
> +                */
> +               break;
> +       case HID:
> +               /* currently unknown how to switch to HID */
> +               fprintf(stderr,
> +                       "csr2: Switching to hid mode is not implemented\n");
> +               return -1;
> +               break;

Instead of "return -1; break;"  you can do:

err = -1;
break;

> +       }

Add an empty line here to separate the "return err" from the rest of the code.

> +       return err;
> +}
> +
>  static int hid_logitech_send_report(int fd, const char *buf, size_t size)
>  {
>         struct hiddev_report_info rinfo;

Best Regards,
-- 
Anderson Lizardo
http://www.indt.org/?lang=en
INdT - Manaus - Brazil
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux