Ticket #17746: usb_rndis-diff.txt

File usb_rndis-diff.txt, 3.4 KB (added by bipolar, 10 months ago)
Line 
1diff --git a/src/add-ons/kernel/drivers/network/ether/usb_rndis/Driver.cpp b/src/add-ons/kernel/drivers/network/ether/usb_rndis/Driver.cpp
2index da7bbf1d..cc5f4e1c 100644
3--- a/src/add-ons/kernel/drivers/network/ether/usb_rndis/Driver.cpp
4+++ b/src/add-ons/kernel/drivers/network/ether/usb_rndis/Driver.cpp
5@@ -122,13 +122,16 @@ init_driver()
6 &usb_rndis_device_removed
7 };
8
9- static usb_support_descriptor supportDescriptor = {
10- 0xE0, /* CDC - Wireless device */
11- 0x01, 0x03, /* RNDIS subclass/protocol */
12- 0, 0 /* no specific vendor or device */
13+ static usb_support_descriptor supportDescriptor[] = {
14+ { // Standard USB-RNDIS devices
15+ 0xE0, /* CDC - Wireless device */
16+ 0x01, 0x03, /* RNDIS subclass/protocol */
17+ 0, 0 /* no specific vendor or device */
18+ },
19+ { 0x02, 0x00, 0x00, 0x04e8, 0x6864 }
20 };
21
22- gUSBModule->register_driver(DRIVER_NAME, &supportDescriptor, 1, NULL);
23+ gUSBModule->register_driver(DRIVER_NAME, supportDescriptor, 2, NULL);
24 gUSBModule->install_notify(DRIVER_NAME, &notifyHooks);
25 return B_OK;
26 }
27diff --git a/src/add-ons/kernel/drivers/network/ether/usb_rndis/RNDISDevice.cpp b/src/add-ons/kernel/drivers/network/ether/usb_rndis/RNDISDevice.cpp
28index b132b28d..e9ac6aaa 100644
29--- a/src/add-ons/kernel/drivers/network/ether/usb_rndis/RNDISDevice.cpp
30+++ b/src/add-ons/kernel/drivers/network/ether/usb_rndis/RNDISDevice.cpp
31@@ -627,10 +627,20 @@ RNDISDevice::_SetupDevice()
32 for (size_t j = 0; j < config->interface_count && !found; j++) {
33 const usb_interface_info *interface = config->interface[j].active;
34 usb_interface_descriptor *descriptor = interface->descr;
35- if (descriptor->interface_class != USB_COMMUNICATION_WIRELESS_DEVICE_CLASS
36- || descriptor->interface_subclass != 0x01
37- || descriptor->interface_protocol != 0x03
38- || interface->generic_count == 0) {
39+ if (interface->generic_count == 0) {
40+ // Ignore this interface, it doesn't have enough endpoints, try the next one
41+ continue;
42+ } else if (descriptor->interface_class == USB_COMMUNICATION_WIRELESS_DEVICE_CLASS
43+ && descriptor->interface_subclass == 0x01
44+ && descriptor->interface_protocol == 0x03) {
45+ // Looks good!
46+ } else if (descriptor->interface_class == USB_COMMUNICATION_DEVICE_CLASS
47+ && descriptor->interface_subclass == 0x02
48+ && descriptor->interface_protocol == 0xFF) {
49+ // ToDo: check interface string here, "continue" if it's not "RNDIS Communications Control"
50+ } else {
51+ // Interface does not match either of our known ways to identify an RNDIS interface,
52+ // ignore it and try the next one
53 continue;
54 }
55
56@@ -679,10 +689,9 @@ RNDISDevice::_SetupDevice()
57 // check that the indicated control interface fits our needs
58 usb_interface_info *interface = config->interface[controlIndex].active;
59 usb_interface_descriptor *descriptor = interface->descr;
60- if ((descriptor->interface_class != 0xE0
61- || descriptor->interface_subclass != 0x01
62- || descriptor->interface_protocol != 0x03)
63- || interface->endpoint_count == 0) {
64+ if ((interface->endpoint_count == 0)
65+ || ! ((descriptor->interface_class == USB_COMMUNICATION_WIRELESS_DEVICE_CLASS && (descriptor->interface_protocol == 0x01 || descriptor->interface_protocol == 0x03))
66+ || (descriptor->interface_class == USB_COMMUNICATION_DEVICE_CLASS && (descriptor->interface_protocol == 0x02 || descriptor->interface_protocol == 0xFF)))) {
67 TRACE_ALWAYS("control interface invalid\n");
68 return B_ERROR;
69 }