Skip to content

USBX RNDIS is not working on Linux + bugfix #171

Open
@kulichbulich

Description

@kulichbulich

STM32CubeIde for MCU STM32U5A9NJHXQ (MCU package v1.6.0, USBX v6.2.0) generated incorrect RNDIS code. RNDIS is working on Windows but failed on Linux with this dmesg messages during enumeration:

[ 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

The problem is that message with RNDIS ID: 0x01010101 is not implemented. With this modification:

In file ux_device_class_rndis_msg_query.c

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;

With this modification, the RNDIS device works correctly on both systems Linux and Windows.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions