kliment / 4pi-firmware

18 stars 21 forks source link

CDC device may not enumerate on Mac #4

Closed tlalexander closed 11 years ago

tlalexander commented 11 years ago

Hey!

I'm excited for this board and I noticed you're using the CDC example code from Atmel. Well, I'm using the same code (well, its a SAM7 but otherwise the code is largely identical) on a project I have, and I noticed that my device worked great in Windows but refused to enumerate on the mac. It said invalid device descriptor for the first interface (which is the control interface).

I don't know a lot about USB, but I looked a bit up and it turns out Atmel's example is in fact wrong, Windows just isn't as picky, and you can change one character in the code to fix it!

The device presents two interfaces - one control interface and one data interface. Control deals with fancy USB stuff and data deals with the actual RX and TX business.

Well, this little bit of code in at91lib / usb / device / cdc-serial / CDCDSerialDriverDescriptors.c

is wrong!

// Class-specific call management functional descriptor { sizeof(CDCCallManagementDescriptor), CDCGenericDescriptor_INTERFACE, CDCGenericDescriptor_CALLMANAGEMENT, CDCCallManagementDescriptor_SELFCALLMANAGEMENT, 0 // No associated data interface },

That is the control interface descriptor, and it says "no associated data interface", but in fact the data interface is interface #1, so that 0 needs to be a 1! Change the value and the device will enumerate on a Mac without drivers, and still happily works with windows just fine.

sivu commented 11 years ago

Good catch, tho this currently works fine for me on OSX 10.8.

I will check the descriptor and update it to be more compatible. Thanks!

tlalexander commented 11 years ago

Interesting! I'm in 10.8 too.

No idea why it would work for you!

sivu commented 11 years ago

interface descriptors updated