Fix windows COM port enumeration

This commit is contained in:
dak664 2010-10-22 19:15:43 +00:00
parent 00a000cca0
commit 7be7a34bbb
3 changed files with 43 additions and 14 deletions

View file

@ -288,18 +288,35 @@ USB_INTERFACEDESC( \
//_____ D E F I N I T I O N ________________________________________________
/************* COMPOSITE DEVICE DESCRIPTORS (using IAD) **********/
//TODO:Serial port enumeration will prevent falling through to the
//supported network on Mac or Windows. Linux will take either.
//Once Windows loads the RNDIS driver it will use it on a subsequent
//Mac enumeration, and the device will fail to start.
//This doesn't seem to hurt anything but beware, system corruption is
//a possibility.
#if USB_CONF_MACINTOSH
FLASH uint8_t usb_dev_config_order[] = {
// USB_CONFIG_RNDIS_DEBUG, //Enable here for Windows COM port debugging? (USB_CONF_CDC=1)
USB_CONFIG_ECM_DEBUG, //Prefer CDC-ECM network enumeration
USB_CONFIG_ECM,
USB_CONFIG_RNDIS_DEBUG,
USB_CONFIG_RNDIS,
USB_CONFIG_EEM,
#if USB_CONF_STORAGE
USB_CONFIG_MS,
#endif
};
#else
FLASH uint8_t usb_dev_config_order[] = {
USB_CONFIG_RNDIS_DEBUG, //Prefer RNDIS network enumeration
USB_CONFIG_RNDIS,
USB_CONFIG_ECM_DEBUG,
USB_CONFIG_RNDIS_DEBUG, //Enable here for macintosh CDC-ECM enumeration
USB_CONFIG_ECM,
USB_CONFIG_EEM,
#if USB_CONF_STORAGE
USB_CONFIG_MS,
#endif
};
#endif /* USB_CONF_MACINTOSH */
// usb_user_device_descriptor
FLASH S_usb_device_descriptor usb_dev_desc_composite =

View file

@ -65,10 +65,15 @@
// USB Device descriptor
#define USB_SPECIFICATION 0x0200
#if 1
#define COMPOSITE_DEVICE_CLASS 0x02 // Misc
#define COMPOSITE_DEVICE_SUB_CLASS 0x00 // Common
#define COMPOSITE_DEVICE_PROTOCOL 0x00 // IAD
#else //Windows wants these for composite device, but above seems to work anyway
#define COMPOSITE_DEVICE_CLASS 0xEF // Misc
#define COMPOSITE_DEVICE_SUB_CLASS 0x02 // Common
#define COMPOSITE_DEVICE_PROTOCOL 0x01 // IAD
#endif
#define NETWORK_DEVICE_CLASS 0x02 // CDC ACM
#define NETWORK_DEVICE_SUB_CLASS 0x02 //

View file

@ -307,7 +307,7 @@ void usb_get_string_descriptor_sram(U8 string_type) {
Usb_send_control_in();
}
bail:
//bail:
if(Is_usb_receive_out()) {
//! abort from Host
Usb_ack_receive_out();
@ -404,7 +404,7 @@ void usb_get_string_descriptor(U8 string_type) {
Usb_send_control_in();
}
bail:
//bail:
if(Is_usb_receive_out()) {
//! abort from Host
@ -441,10 +441,12 @@ void usb_get_descriptor(void)
U8 descriptor_type ;
U8 string_type ;
U8 dummy;
U8 byteswereread;
zlp = FALSE; /* no zero length packet */
string_type = Usb_read_byte(); /* read LSB of wValue */
descriptor_type = Usb_read_byte(); /* read MSB of wValue */
byteswereread = 0;
switch (descriptor_type)
{
@ -464,17 +466,22 @@ void usb_get_descriptor(void)
default:
dummy = Usb_read_byte();
dummy = Usb_read_byte();
dummy = Usb_read_byte();
dummy = Usb_read_byte();
if( usb_user_get_descriptor(descriptor_type, string_type)==FALSE )
LSBwLength = Usb_read_byte();
MSBwLength = Usb_read_byte();
byteswereread=1;
if( usb_user_get_descriptor(descriptor_type, string_type)==FALSE ) {
Usb_enable_stall_handshake(); //TODO:is this necessary?
Usb_ack_receive_setup(); //TODO:is this necessary?
return;
}
break;
}
if (byteswereread==0) {
dummy = Usb_read_byte(); //!< don't care of wIndex field
dummy = Usb_read_byte();
LSBwLength = Usb_read_byte(); //!< read wLength
MSBwLength = Usb_read_byte();
}
Usb_ack_receive_setup() ; //!< clear the receive setup flag