RobertCNelson / boot-scripts

Just a bunch of useful scripts placed under /opt/scripts/
125 stars 132 forks source link

Add config for CDC ECM #50

Closed dlech closed 7 years ago

dlech commented 7 years ago

This adds a new config for using CDC ECM by default. This works with Mac and Linux. The RNDIS config is moved to a second configuration. OS descriptors are used so that Windows will select the second configuration with RNDIS.

Tested this with @jadonk. There are going to be 2 usb network devices now, so some more tweaks will be needed, but this is a start.

dlech commented 7 years ago

We found out this breaks the mass storage and serial on Windows.

jadonk commented 7 years ago

It seems the OS Descriptors might only be required for XP. For Vista and newer, https://msdn.microsoft.com/de-de/library/ff538820(v=vs.85).aspx seems to indicate that Class 0xEF, SubClass 0x04 and Protocol 0x01 should load an RNDIS driver.

I'm getting permission denied trying to manually: echo "0xFE" > functions/rndis.usb0/bInterfaceClass

I'll try putting it in the script and rebooting at some point here.

jadonk commented 7 years ago

Seems like https://github.com/beagleboard/linux/blob/4.4/drivers/usb/gadget/function/f_rndis.c doesn't include https://patchwork.kernel.org/patch/4961921/, so I suspect it is returning a Class/SubClass/Protocol other than expected by Windows and defined by the USB-IF at http://www.usb.org/developers/defined_class/#BaseClassEFh.

dlech commented 7 years ago

I can't seem to figure out how to do os descriptors for more than one interface. According to the Microsoft specs, you should be able to do this, but on Win10, I get an error whenever I try to set bCount > 1 (the error can only be seen using Microsoft Message Analyzer).

I also discovered that if there is only one USB configuration, os descriptors are ignored by Windows.

So, I'm closing this PR since I don't think it will work with multiple USB interfaces.

However, I think I have discovered an alternate solution using Class 0xEF, SubClass 0x04 and Protocol 0x01. More on that tomorrow...