RobertCNelson / boot-scripts

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

Add CDC/ECM function to USB gadget #51

Closed dlech closed 7 years ago

dlech commented 7 years ago

This adds a CDC/EMC USB networking function to the multifunction USB gadget device. This is needed to get USB networking working on macOS with no 3rd party drivers. It also works better than RNDIS on Linux. Also, we will be changing the USB class of the RNDIS driver, so it will no longer be detected by Linux, so CDC will be the only networking interface that shows up on Linux.

dlech commented 7 years ago

This will create a second USB network interface named usb1. So, I am thinking we will need to modify autoconfigure_usb0.sh to take parameters so that we can pass usb0 or usb1 to setup both interfaces. Is there anywhere else that needs to be changed?

RobertCNelson commented 7 years ago

Sweet! there's a few usb0's sprinkled around to disable connman from touching it.. ;)

dlech commented 7 years ago

I tried modifying autoconfigure_usb0.sh to handle both usb interfaces, but I ran in to a problem that udhcpd can only handle one interface, so it can be used for one or the other but not both.

dlech commented 7 years ago

I read up on https://groups.google.com/forum/#!msg/beagleboard/3Um2Xqa2MHU/g8KcnBnFBQAJ, which I kind of already knew the issues with connman and tethering since we use it in ev3dev.

Since macOS (always) and Linux (usually) supports mDNS, what if we leave usb0 the way it is with a static IP managed via udchpd and use connman to manage usb1? usb1 won't have a predictable IP, but we can just use beaglebone.local.

dlech commented 7 years ago

I've added another commit that configures usb1.

RobertCNelson commented 7 years ago

thanks @dlech !

RobertCNelson commented 7 years ago

Sweet!!!

clean windows 7 & 10 machines working here

@jadonk we might have to make a note about the "un-used" second cdc-ecm device that windows detects but no drivers, as it's using the other rndis driver..

Regards,

jadonk commented 7 years ago

Does connman tether also provide both a DHCP service and a DNS proxy? Can we inject beaglebone.local into the DNS entries?

Will the fact we now provide a gateway screw up operating systems into thinking they can get to the Internet, except in the case they actually can?

jadonk commented 7 years ago

Reading https://www.mail-archive.com/connman@connman.net/msg15627.html

jadonk commented 7 years ago

Are we using dnsmasq everywhere now for DNS? Will it provide our address when used as a DNS proxy?

dlech commented 7 years ago

For Windows users, nothing has changed other than they will have the extra CDC EMC device with no matching driver.

I haven't used ConnMan tethering with macOS/Linux enough to notice any nuances/problems that it might cause.