FTDI Community

Please login or register.

Login with username, password and session length.
Advanced Search  

News:

Welcome to the FTDI Community!

Please read our Welcome Note

Technical Support enquires
please contact the team
@ FTDI Support


New Bridgetek Community is now open

Please note that we have created the Bridgetek Community to discuss all Bridgetek products e.g. EVE, MCU.

Please follow this link and create a new user account to get started.

Bridgetek Community

Show Posts

You can view here all posts made by this member. Note that you can only see posts made in areas to which you currently have access.

Messages - kaspro

Pages: [1]
1
Hello,

If there are 3 endpoints to monitor then the USBH_transfer_async is good way to do it.

You pass in a unique ID (one for each endpoint) and a callback function (the parameters are in the ft900_usbh.h header file).

typedef int8_t (*USBH_callback)(uint32_t id, int8_t status, size_t len, uint8_t *buffer);

There are no examples but it is the same as USBH_transfer except that you get your buffer filled and your callback called during the USBH_Process call. The ID will be used to differentiate the endpoints.

Best Regards,
FTDI Community

Thank you so much! I actually solved & nailed the async transfer function (it's working great!)

Right now I'm just trying to figure out how to get the HID Interface Report Descriptors so I can do some parsing on the device. They look like this:

Code: [Select]
Interface 0 HID Report Descriptor Keyboard
Item Tag (Value) Raw Data
Usage Page (Generic Desktop) 05 01
Usage (Keyboard) 09 06
Collection (Application) A1 01
    Usage Page (Keyboard/Keypad) 05 07
    Usage Minimum (Keyboard Left Control) 19 E0
    Usage Maximum (Keyboard Right GUI) 29 E7
    Logical Minimum (0) 15 00
    Logical Maximum (1) 25 01
    Report Size (1) 75 01
    Report Count (8) 95 08
    Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit) 81 02
    Input (Cnst,Ary,Abs) 81 01
    Usage Minimum (Undefined) 19 00
    Usage Maximum 2A FF 00
    Logical Minimum (0) 15 00
    Logical Maximum (255) 26 FF 00
    Report Size (8) 75 08
    Report Count (6) 95 06
    Input (Data,Ary,Abs) 81 00
    Usage Page (LEDs) 05 08
    Usage Minimum (Num Lock) 19 01
    Usage Maximum (Scroll Lock) 29 03
    Logical Minimum (0) 15 00
    Logical Maximum (1) 25 01
    Report Size (1) 75 01
    Report Count (3) 95 03
    Output (Data,Var,Abs,NWrp,Lin,Pref,NNul,NVol,Bit) 91 02
    Report Count (5) 95 05
    Output (Cnst,Ary,Abs,NWrp,Lin,Pref,NNul,NVol,Bit) 91 01
End Collection C0

I'd ideally parse this information for all "Usage (Keyboard)" so I know what I'm receiving, even from the weirdest of keyboards.

2
Discussion - Software / FT90X Get an Interface's HID Report Descriptor
« on: January 06, 2021, 04:04:15 AM »
I'm trying to write some code on my FT90X to both get and parse multiple Interface HID Report Descriptors.

I'm doing this to make sure I'm only listening to interfaces that are Keyboard/Keypad and to parse out the data properly using the report descriptor.

Looking through the FT9xx API Programmers Manual and all the example code in the Bridgetek folder, I never see an example of getting the report descriptors. Only setting them (USB Device examples)

The end goal is that I listen to all keyboard-reporting interfaces, parse the data they send back so I can see what keys a user is pressing, and use that data for my main application.

How can I get this information? My USB Host code can currently listen for a HID device, initialize the interfaces, and listen to them. I just don't know where to get those Interface HID Report Descriptors.

3
I'm making a Keyboard-to-Controller adapter using the FT908. Pretty simple design: You plug a keyboard into one end, and the other end plugs into a Nintendo Switch. From there, you can use your keyboard as a controller.

Right now I'm trying to handle the USB keyboard inputs and this harder than I expected.

Right now I'm using a Corsair K65. It has 3 endpoints and I need to listen to them all simultaneously:
  • A "BOOT" endpoint (where it sends data matching the typical 6-KRO USB report for BIOS)
  • A "Media Controls" endpoint (things like volume up/down)
  • A "NKRO" endpoint (uses a bitmap so you can press ALL THE KEYS!)

I also made a video of me going through the keyboard and asking questions: https://photos.app.goo.gl/7j98istA1GyRfbjE6

The two questions I have:
  • I originally used the "USBH Example HID" code as a starting point, but realized that the "USBH_HID_get_report" is a blocking call to only 1 endpoint (which is a no-go - I need to listen to all 3 endpoints and receive from any as an interrupt.) I found out about "USBH_transfer_async" which seems like what I need. I combined it with looping over "USBH_Process" but it isn't yielding me any data in the buffer I'm sending in. I can't find any code examples using "USBH_transfer_async" - how should I be doing this? Figured this and it's working perfectly (although the documentation says NOT to re-call the "USBH_transfer_async" from within the callback, one of the examples does just that so so far it's been working pretty good)
  • When I do start receiving data, do I need to write unique code to decode all three of those different endpoints? The boot protocol, the volume  All I want is the "keys" sent to me. If I do have to write unique code for each EP, this seems like an impossible task then right? There are hundreds of thousands of keyboards and I assume all of them send different kinds of reports. How could I possibly write code to interpret all of them?? Just looked at my Razer Tartarus and it also has an insanely unique way of reporting keys. HELP!!!

I've attached the USB HID data of my keyboard (interfaces, endpoints, etc.) Hope this helps someone answer my question 🙏

4
Hey all, I'm currently working on hardware for the Nintendo Switch and one requirement is that the USB device needs to report back bMaxPacketSize0 of 64.

I'm attaching two files to this forum post: The descriptors of the controller I'm emulating, and my VNC2 solution. You'll notice they match 1:1 except for the bMaxPacketSize0.

Once I set bMaxPacketSize0, the hardware stops working. I've run the software with a debugger, and once I hit the last line below, it dies.

Code: [Select]
hidkbd_ioctl.ioctl_code = VOS_IOCTL_USBSLAVEHID_ATTACH;
hidkbd_ioctl.set.data = (void *)hUSBSLAVE_1;
vos_dev_ioctl(hUSBSLAVE_HID, &hidkbd_ioctl);

It works perfectly fine if I leave bMaxPacketSize0 at 8 (it even works in Windows!) but the Switch requires this to be 64.

Anyone know if this is a possibility with the VNC2? I've spent many hours on this one problem (close to 30) and already purchased a lot of hardware for it so I'm hoping this will work.

I've also looked through every sample and none of them ever modify bMaxPacketSize0 which is scary to me.

5
Discussion - Software / Re: USB Keyboard Host on VNCII
« on: April 15, 2020, 05:42:29 AM »
Just a heads up, I've been working on hardware for the Nintendo Switch, which requires bMaxPacketSize0 to be 64.

Once I change that value from 8 to 64 though, the VNC2 fails. I'm about to make a separate forum post about this, but I've invested a lot of time into this project so far and would really like to know if the VNC2 is just not capable of doing bMaxPacketSize0 = 64.

Pages: [1]