Replies: 8 comments
-
|
You can slightly modify the vendor class and register it as a custom driver. check https://github.com/kkitayam/akiprobe as example. Just declare the interface then use |
Beta Was this translation helpful? Give feedback.
-
|
I had not found "app" driver, thanks. Is that essentially a generic driver (does not check class) that has bulk in and out? Assuming this works, this becomes a very much non urgent "would be nice to have a smart card / CCID driver" that does the CCID packets at least. An am struggling to work this out - the managed components from ESP IDF component registry may be out of date, but what |
Beta Was this translation helpful? Give feedback.
-
Yep, just modify the class code check to meet your need.
This check is needed for each class to avoid messing around with other class drivers, on device init the configuration descriptor passes into all classes, the class driver should process only the one it concerns.
Do what ever you want, it's only used at the file start as a compilation switch tinyusb/src/class/vendor/vendor_device.c Line 29 in 5ef55bf |
Beta Was this translation helpful? Give feedback.
-
|
OK, a generic class could have a #define for what class code to check even. And even #defines to say which interfaces to expect with a simple BULK IN/OUT default perhaps. But it seems I will have to change some tinyusb code to make anything work for me, bodging VENDOR or some such. I can do that, but makes it a maintenance headache as I can never update the managed components from ESP IDF without zapping my changes. A feature request (apart from smart card specific) would be a way to allow, by #defines, me to have a class code of my choosing with simple read/write functions for bulk data. There must be many possible classes tinyusb does not natively handle, and may never handle if too niche, which could be accommodated by such a mechanism, including smart cards. A |
Beta Was this translation helpful? Give feedback.
-
You don't need to poke around managed components, I wasn't clear that I means was copy vendor class driver and modify it in your project (thus app driver), not in-place modification.
Vendor class code (0xFF) is defined by USB-IF. Everyone has their own special needs that driver can't all handle, like the CMSIS probe example I've linked have some custom data buffer handling. Take your card reader as example, you can strip off all the fifo stuff like |
Beta Was this translation helpful? Give feedback.
-
|
OK, can I just copy vendor class and change. Literally copy the C code to my I am a If so, that will be a good way forward, thank you. If I have missed the point, some clues would be appreciated. |
Beta Was this translation helpful? Give feedback.
-
Yep, copy the code and modify the name to avoid collision, to something like Then add driver registration: usbd_class_driver_t const ccid_driver = {
#if CFG_TUSB_DEBUG >= 2
.name = "CCID driver",
#endif
.init = ccid_init,
.reset = ccid_reset,
.open = ccid_open,
.control_xfer_cb = ccid_control_xfer_cb,
.xfer_cb = ccid_xfer_cb,
.sof = NULL
};
usbd_class_driver_t const* usbd_app_driver_get_cb(uint8_t* driver_count)
{
*driver_count = 1;
return &ccid_driver;
} |
Beta Was this translation helpful? Give feedback.
-
|
I'll try that - thanks for you help. I think I understand now, and had not appreciated the Of course once I have code this and got it working, I'm happy to donate it to the tinyusb project if you like. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Related area
I am trying to make a CCID reader device
Hardware specification
ESP32S3
Is your feature request related to a problem?
Firstly, please, let me know if there is any way to make a "generic" device with simple bulk in and out.
If so, that would suit me for now. But so far I have not found one - perhaps this could itself be a feature to allow for a variety of classes of devices that are not yet covered by TinyUSB. I tried VENDOR, but had not realised that it specific to class 0xFF, and if with that check commented out, looks like it only does bulk in (am I right?).
A generic driver for any class would be ideal.
Describe the solution you'd like
What I am looking for is device class for Smart Card (0x0B), and in my case I am happy just to have the CCID messages built of from the 64 byte packets (is that how it works), a callback with a request and returning a reply as a transfer.
Now, looking at the code, it is probably possible for me to actually do this change, bodging one of the existing classes. Is that helpful?
But as I say, if there is any way to do a generic bulk in/out class that would also suit me.
Perhaps the VENDOR class could avoid checking the class is 0xFF and add bulk in and out?
I have checked existing issues, dicussion and documentation
Beta Was this translation helpful? Give feedback.
All reactions