CRC usb native interface

Hello all.
I am working on a generic c++ usb interface which will be generated from the json interface definition.
I am almost finished. The only problem I have is finding out how exactly the crc needs to be calculated based on the json interface definition.
I read the code in protocol.hpp but after trying for two hours I cannot generate a crc with the same value as the odrivetool.
Does any one know exactly how to calculate the crc or can give be pointers in the code direction.
I used the data I got from endpoint 0 as input for the crc calculation.


I also tried calculating the CRC in java, but eventually gave up. I think the CRC only changes when you modify your firmware, so I just hardcode the CRC after reading what the ODrivetool sends.

If you want to get it right try looking at the python side. It also calculates the CRC, and you can place breakpoints if you’ve installed a debugger.

Based on the code the crc changes when the json interface changes. I want my library to handle that.
I’m going too hack the code. When I have something that calcualtes the crc the same as odrive I will post it here.

I ran into this issue prototyping my Rust driver, and opened Issue 330, which has a response describing exactly how the CRC should be calculated. I agree that the comment in the code isn’t that helpful and could be improved.