Main Site Documentation

Fez panda 2 usb client keyboard


#1

Hi all. I’m new. My question pertains to the fez panda 2 but I think it’s relevant to all USBizi chips.

I’m trying to emulate a keyboard usb device. This works on my PC, however it does not work in the bootloader screen of my laptop. I verified that plugging in an actual usb keyboard while the bootloader screen is showing will work.

You can see my code at http://pastebin.com/JVrL4qpc

You will see there is a 7 second sleep before starting anything. I’m doing this to wait for the laptop to start up and reach the bootloader screen. I also tried to start the keyboard as soon as the fez powers up, and only start typing after 7 seconds. This didn’t solve the issue.

I can see that the usb client does reach the Running state because the LED does blink after 7 seconds.

Any help would be appreciated.


#2

USBizi uses standard HID class so it should work with any system. I am not sure why you are having problem.


#3

I’m wondering if perhaps the problem is with how keystrokes are being sent. Is it possible to see the source code to USBC_Keyboard? Would it be at all worthwhile to try to start my own USBC_Device with a keyboard?

Edit: upon inspecting the USBC_Keyboard class it appears that the keyboard descriptor does not match the typical example keyboard descriptor found here http://www.devasys.com/PD11x/JHWP.pdf or here http://www.usb.org/developers/hidpage/

Could this be an issue? Unfortunately I don’t know enough about this to try out a solution. After replacing kbReportDescriptorPayload with one generated by HID Descriptor Tool, the computer seems to ignore the device. I would be very grateful if you guys could look into this or offer some direction of help.

Final edit
After sniffing the handshake my keyboard makes, I tracked down the issue. When the usb interface is being configured, interfaceSubclass is 0 and interfaceProtocol is 0. For the keyboard to be recognized at boot, they need to be

bInterfaceClass 03h HID
bInterfaceSubClass 01h Boot Interface
bInterfaceProtocol 01h Keyboard

So the following change to the Keyboard constructor resolves the issue


Configuration.UsbInterface usbInterface = new Configuration.UsbInterface(0, endpoints)
{
    bInterfaceClass = 3,
    bInterfaceSubClass = 1,
    bInterfaceProtocol = 1,
    classDescriptors = new Configuration.ClassDescriptor[] { new Configuration.ClassDescriptor(0x21, kbClassDescriptorPayload) }
};

Please propagate this change to the future versions of the usb client classes.


#4

Thanks for sharing