Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

USBX RNDIS is not working on Linux + bugfix #171

Open
kulichbulich opened this issue Sep 3, 2024 · 0 comments
Open

USBX RNDIS is not working on Linux + bugfix #171

kulichbulich opened this issue Sep 3, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@kulichbulich
Copy link

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.

@kulichbulich kulichbulich added the bug Something isn't working label Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant