Guidance on writing a HID driver

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

 



Hello,

I am looking at writing a driver for the Logitech G13 which reports as a
HID. There is already a version of a driver (not in the kernel) that uses
quirks to get the usbhid driver to ignore the device, but I was hoping to
write a driver that would integrate a bit more smoothly using the hid api.

At the end of this email is a listing that I get from 'lsusb -vv' for the
g13.

The existing driver uses a urb to transfer control messages, and in probe
establishes the urb with:

  dev = interface_to_usbdev(iface);
  pipe = usb_rcvintpipe(dev, endpoint->bEndpointAddress);

  /* create a urb, and a buffer for it */
  urb = usb_alloc_urb(0, GFP_KERNEL);
  if (!urb) return -ENOMEM;
  buf = usb_buffer_alloc(dev, KEY_BUFFER_SIZE, GFP_KERNEL, &new_dma);
  if (!buf) return -ENOMEM;
  usb_fill_int_urb(urb, dev, pipe, buf, KEY_BUFFER_SIZE, g13_irq, 0,
endpoint->bInterval);
  urb->transfer_dma = new_dma;
  urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;

Would I need to connect to HIDRAW to establish the same control? Should I
forget about using the hid api and go with the raw usb?

Thanks,

====

Device report:

Bus 005 Device 007: ID 046d:c21c Logitech, Inc.
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0         8
  idVendor           0x046d Logitech, Inc.
  idProduct          0xc21c
  bcdDevice            1.03
  iManufacturer           0
  iProduct                1 G13
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           41
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              500mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 No Subclass
      bInterfaceProtocol      0 None
      iInterface              0
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.11
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      61
         Report Descriptors:
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0008  1x 8 bytes
        bInterval               2
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
Device Status:     0x0000
  (Bus Powered)



--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux