imxrt-rs / imxrt-usbd

USB device driver for i.MX RT processors
Apache License 2.0
7 stars 9 forks source link

Use separate bitflag contains calls in check_errors #9

Closed lkolbly closed 3 years ago

lkolbly commented 3 years ago

bitflags.contains returns true if all of the flags are present. I have a dev branch based on c37c671e10c411fddf995098e5172944c6aab906, attempting to add isochronous support, and this caused TRANSACTION_ERROR statuses to panic (after using the try_into implementation).

In this implementation, I think this would cause errors to silently be ignored, but I haven't tested it.

mciantyre commented 3 years ago

Great catch, thanks for the fix!

I gave it a test with the usb-device host tests, and the CDC example. Both are still working. You're right that this would silently ignore errors. I placed a panic! in the error branch, after your change, to see if that was the case. I didn't hit that panic, so it seems I've been lucky so far.