Re: Need help to support USB3.0 HID Keyboard device

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

 



On Fri, 22 Nov 2013, Bhavik Kothari wrote:

> Hi,
> 
> I have been working on USB3.0 device driver and wanted to support USB3.0 
> HID (keyboard).
> 
> To support HID Keyboard device, I have made below Interface descriptor:
> 
> Interface Descriptor with alternate settings 0:
> 
>      bLength = 0x9;
>      bDescriptorType = 0x4 (USB_DT_INTERFACE);
> 
>      bInterfaceNumber = 0x0;
>      bAlternateSetting = 0x0;
>      bNumEndpoints = 0x0;

That's not right.  A keyboard needs to have an Interrupt-IN endpoint.  
Otherwise, how can it tell the computer when a key has been pressed or 
released?

>      bInterfaceClass = (0x3) USB_CLASS_HID;
>      bInterfaceSubClass = 0x0;

This probably should be 1.  Most keyboards implement a boot interface.

>          bInterfaceProtocol = 0x1 (keyboard);
>          iInterface = 0x0;
> 
> Interface Descriptor with alternate settings 1 along with Super speed 
> endpoints:
> 
>          bLength = 0x9;
>          bDescriptorType = 0x4 (USB_DT_INTERFACE);
> 
>          bInterfaceNumber = 0x0;
>          bAlternateSetting = 0x1;
>          bNumEndpoints = 0x2; (One for EP IN Interrupt and other for EP 
> OUT Interrupt)
>          bInterfaceClass = (0x3) USB_CLASS_HID;
>          bInterfaceSubClass = 0x0;
>          bInterfaceProtocol = 0x1 (keyboard);
>          iInterface = 0x0;

Why do you need or want an alternate setting?

> However, when xHCI does set_config at that time Interface zero and 
> alternate setting is zero, it never does set_interface with interface 
> zero and alternate setting one, hence host does not detect HID device.

You sound confused.  Of course the host detects the HID device.  If it 
didn't detect the device, it wouldn't issue a Set-Config request.

Your problem is that the HID driver never issues a Set-Interface 
request.  This is because HID devices generally don't have alternate 
interfaces.

> So, would you please assist me that what I have to do, so host does set 
> interface with alternate setting one.

Don't use alternate setting 1; use altsetting 0.

> Please let me know if you need any more information.
> 
> If I have single Interface descriptor with alternate setting zero along 
> with Super speed endpoints like below, then host detects HID (keyboard) 
> driver,
> 
> Interface Descriptor with alternate settings 0:
> 
>          bLength = 0x9;
>          bDescriptorType = 0x4 (USB_DT_INTERFACE);
> 
>      bInterfaceNumber = 0x0;
>          bAlternateSetting = 0x0;
>          bNumEndpoints = 0x2; (One for EP IN Interrupt and other for EP 
> OUT Interrupt)
>          bInterfaceClass = (0x3) USB_CLASS_HID;
>          bInterfaceSubClass = 0x0;
>          bInterfaceProtocol = 0x1 (keyboard);
>          iInterface = 0x0;

See, that's what you should do.

> To support HID (keyboard) with USB3.0 CV, I need to have Interface 
> descriptor with alternate setting zero, which does not contain Interrupt 
> endpoint with max packet size greater than 64.

Right.  A keyboard certainly shouldn't need to send more than 64 bytes
per packet.

Alan Stern

--
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