Skip to main content
AlexSmart
Associate III
March 7, 2024
Solved

USB Device RNDIS Linux drivers

  • March 7, 2024
  • 3 replies
  • 5853 views

Im struggling with USB Device RNDIS example . Works fine on Windows PC, but no network interface appears on Linux, it listed in lsusb output.

I cant find any topics related to that issue

Best answer by Mohamed_AYED

I mean that windows has the only host RNDIS class driver  support that can recognize RNDIS USB devices. 

You are right st usb middleware and cdc ecm device class run in standalone mode .

And azure rtos cdc ecm class run in rtos mode with threadx. 

 

3 replies

Explorer
March 7, 2024

Hi @AlexSmart 

RNDIS is a Microsoft proprietary protocol, as i know that rndis host is supported only with windows. for linux you can use the CDC-ECM class (Ethernet Control Model)

AlexSmart
AlexSmartAuthor
Associate III
March 8, 2024

well its not host but device, and for CDC-ECM ok, I can try that, but sadly no CMSIS rtos compatible examples found. Maybe there is a way to push those drivers to linux?

Mohamed_AYEDBest answer
Explorer
March 8, 2024

I mean that windows has the only host RNDIS class driver  support that can recognize RNDIS USB devices. 

You are right st usb middleware and cdc ecm device class run in standalone mode .

And azure rtos cdc ecm class run in rtos mode with threadx. 

 

AlexSmart
AlexSmartAuthor
Associate III
March 8, 2024

Thank you!

Visitor II
September 2, 2024

We had the same problem, USB-ECM works great under Linux and OSX, but it doesn't work under Windows (it can be solved with the driver, but the problem demo version which is free is works only for 30 minutes). Default STM32 RNDIS only worked under Windows and there was a problem with enumeration under Linux, but after debugging I came up with this modification and RNDIS now works under both Windows and Linux.

My problem was that Linux requires a command that is not implemented in the default implementation from ST. It is an RNDIS_MSG_QUERY command with a value of 0x01010101 (UX_DEVICE_CLASS_RNDIS_OID_802_3_PERMANENT_ADDRESS)

[ 5043.521350] usb 5-1.1.3: new high-speed USB device number 17 using xhci_hcd
[ 5043.663724] usb 5-1.1.3: New USB device found, idVendor=0483, idProduct=5742, bcdDevice= 2.00
[ 5043.663740] usb 5-1.1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 5043.663784] usb 5-1.1.3: Product: STM32 USB Device
[ 5043.663791] usb 5-1.1.3: Manufacturer: STMicroelectronics
[ 5043.663796] usb 5-1.1.3: SerialNumber: 000000000001
[ 5043.724852] rndis_host 5-1.1.3:1.0: RNDIS_MSG_QUERY(0x01010101) invalid response - off 16 len 4
[ 5043.724869] rndis_host 5-1.1.3:1.0: rndis get ethaddr, -33
[ 5043.725371] rndis_host: probe of 5-1.1.3:1.0 failed with error -33

 

Modification:

In file ux_device_class_rndis_msg_query.c

kulichbulich_0-1725276103775.png

In function _ux_device_class_rndis_msg_query before default (line 327) put this code:
 
 
        case UX_DEVICE_CLASS_RNDIS_OID_802_3_PERMANENT_ADDRESS            :
 
 
            /* Save the Hardware address in the return message.   */
            _ux_utility_memory_copy(rndis_response + UX_DEVICE_CLASS_RNDIS_CMPLT_QUERY_INFO_BUFFER,
                                    rndis -> ux_slave_class_rndis_local_node_id, UX_DEVICE_CLASS_RNDIS_NODE_ID_LENGTH); /* Use case of memcpy is verified. */
 
            /* Set the total response length.  */
            rndis_response_length = UX_DEVICE_CLASS_RNDIS_NODE_ID_LENGTH;
 
            break;

 

Explorer
September 3, 2024

Hi @kulichbulich

The Azure RTOS transition to open-source is now complete and the first release of ThreadX real-time operating system Eclipse ThreadX 6.4.1 now available under MIT license.   Learn more.

 

You can contribute directly in https://github.com/eclipse-threadx/usbx by creating a PR (pull request), this PR will be reviwed by project committer (ST USB Team included).

 

Visitor II
September 3, 2024

Hi @Mohamed_AYED

I wasn't able to create a pull-request (I'm not a contributor), so I created a bug report with a proposed solution.

https://github.com/eclipse-threadx/usbx/issues/171