1 | diff --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
|
---|
2 | index 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, ¬ifyHooks);
|
---|
25 | return B_OK;
|
---|
26 | }
|
---|
27 | diff --git a/src/add-ons/kernel/drivers/network/ether/usb_rndis/Driver.h b/src/add-ons/kernel/drivers/network/ether/usb_rndis/Driver.h
|
---|
28 | index bc68cfc8..5e24174b 100644
|
---|
29 | --- a/src/add-ons/kernel/drivers/network/ether/usb_rndis/Driver.h
|
---|
30 | +++ b/src/add-ons/kernel/drivers/network/ether/usb_rndis/Driver.h
|
---|
31 | @@ -30,6 +30,7 @@ const char **publish_devices();
|
---|
32 | device_hooks *find_device(const char *name);
|
---|
33 | }
|
---|
34 |
|
---|
35 | +#define TRACE_RNDIS 1
|
---|
36 | #if TRACE_RNDIS
|
---|
37 | #define TRACE(x...) dprintf(DRIVER_NAME ": " x)
|
---|
38 | #else
|
---|
39 | diff --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
|
---|
40 | index b132b28d..ee6332ed 100644
|
---|
41 | --- a/src/add-ons/kernel/drivers/network/ether/usb_rndis/RNDISDevice.cpp
|
---|
42 | +++ b/src/add-ons/kernel/drivers/network/ether/usb_rndis/RNDISDevice.cpp
|
---|
43 | @@ -204,7 +204,7 @@ RNDISDevice::Open()
|
---|
44 | TRACE_ALWAYS("failed to read media state\n");
|
---|
45 | }
|
---|
46 |
|
---|
47 | - status = _ReadLinkSpeed(fDevice);
|
---|
48 | + status = -1; //_ReadLinkSpeed(fDevice);
|
---|
49 | if (status != B_OK) {
|
---|
50 | fDownstreamSpeed = 1000 * 100; // 10Mbps
|
---|
51 | TRACE_ALWAYS("failed to read link speed\n");
|
---|
52 | @@ -627,10 +627,20 @@ RNDISDevice::_SetupDevice()
|
---|
53 | for (size_t j = 0; j < config->interface_count && !found; j++) {
|
---|
54 | const usb_interface_info *interface = config->interface[j].active;
|
---|
55 | usb_interface_descriptor *descriptor = interface->descr;
|
---|
56 | - if (descriptor->interface_class != USB_COMMUNICATION_WIRELESS_DEVICE_CLASS
|
---|
57 | - || descriptor->interface_subclass != 0x01
|
---|
58 | - || descriptor->interface_protocol != 0x03
|
---|
59 | - || interface->generic_count == 0) {
|
---|
60 | + if (interface->generic_count == 0) {
|
---|
61 | + // Ignore this interface, it doesn't have enough endpoints, try the next one
|
---|
62 | + continue;
|
---|
63 | + } else if (descriptor->interface_class == USB_COMMUNICATION_WIRELESS_DEVICE_CLASS
|
---|
64 | + && descriptor->interface_subclass == 0x01
|
---|
65 | + && descriptor->interface_protocol == 0x03) {
|
---|
66 | + // Looks good!
|
---|
67 | + } else if (descriptor->interface_class == USB_COMMUNICATION_DEVICE_CLASS
|
---|
68 | + && descriptor->interface_subclass == 0x02
|
---|
69 | + && descriptor->interface_protocol == 0xFF) {
|
---|
70 | + // ToDo: check interface string here, "continue" if it's not "RNDIS Communications Control"
|
---|
71 | + } else {
|
---|
72 | + // Interface does not match either of our known ways to identify an RNDIS interface,
|
---|
73 | + // ignore it and try the next one
|
---|
74 | continue;
|
---|
75 | }
|
---|
76 |
|
---|
77 | @@ -679,11 +689,25 @@ RNDISDevice::_SetupDevice()
|
---|
78 | // check that the indicated control interface fits our needs
|
---|
79 | usb_interface_info *interface = config->interface[controlIndex].active;
|
---|
80 | usb_interface_descriptor *descriptor = interface->descr;
|
---|
81 | - if ((descriptor->interface_class != 0xE0
|
---|
82 | - || descriptor->interface_subclass != 0x01
|
---|
83 | - || descriptor->interface_protocol != 0x03)
|
---|
84 | - || interface->endpoint_count == 0) {
|
---|
85 | - TRACE_ALWAYS("control interface invalid\n");
|
---|
86 | +
|
---|
87 | + if (interface->endpoint_count == 0) {
|
---|
88 | + TRACE_ALWAYS("control interface has no endpoints\n");
|
---|
89 | + return B_ERROR;
|
---|
90 | + }
|
---|
91 | +
|
---|
92 | + if (descriptor->interface_class == USB_COMMUNICATION_WIRELESS_DEVICE_CLASS) {
|
---|
93 | + if (descriptor->interface_subclass != 0x01 || descriptor->interface_protocol != 0x03) {
|
---|
94 | + TRACE_ALWAYS("control interface invalid interface subclass or protocol\n");
|
---|
95 | + return B_ERROR;
|
---|
96 | + }
|
---|
97 | + } else if (descriptor->interface_class == USB_COMMUNICATION_DEVICE_CLASS) {
|
---|
98 | + // Microsoft USBRNDIS style control interface
|
---|
99 | + if (descriptor->interface_subclass != 0x02 || descriptor->interface_protocol != 0xFF) {
|
---|
100 | + TRACE_ALWAYS("control interface invalid interface subclass or protocol\n");
|
---|
101 | + return B_ERROR;
|
---|
102 | + }
|
---|
103 | + } else {
|
---|
104 | + TRACE_ALWAYS("control interface invalid interface class\n");
|
---|
105 | return B_ERROR;
|
---|
106 | }
|
---|
107 |
|
---|