[Google Pixel 4a Questions & Answers] amolbakre:
Hi,

I was wondering if anyone can help with the problem I'm having. I'm trying to connect a Pixel 4a device to a nanoPi based dongle (ethernet over USB) for experimental / study purpose, but Android does not recognize the device and does nothing.

I've successfuly connected the dongle to an iPhone 11 and that immediately recognizes an ethernet connection and sets up a connection and the phone can then start to access internet even when on airline mode.

I've tested Android 4a with an ethernet OTG dongle and that works. I've spent more than a couple of days on looking into various things, USBHostManger, UsbDevice, UsbInterface etc but no luck.

Below are some logs (that I thought relevant to current problem) that I could get from the device:

4a connected to OTG (This works):

2021-04-18 09:38:27.455 1682-1808/? I/EthernetTracker: interfaceLinkStateChanged, iface: eth0, up: false
2021-04-18 09:38:27.458 1682-1808/? I/EthernetTracker: interfaceLinkStateChanged, iface: eth0, up: false
2021-04-18 09:38:27.460 1682-2238/? D/UsbHostManager: Added device UsbDevice[mName=/dev/bus/usb/002/002,mVendorId=3034,mProductId=33107,mClass=0,mSubclass=0,mProtocol=0,mManufacturerName=Realtek,mProductName=USB 10/100/1000 LAN,mVersion=31.00,mSerialNumberReader=com.android.server.usb.UsbSerialReader@f270f03, mHasAudioPlayback=false, mHasAudioCapture=false, mHasMidi=false, mHasVideoCapture=false, mHasVideoPlayback=false, mConfigurations=[
UsbConfiguration[mId=1,mName=null,mAttributes=160,mMaxPower=36,mInterfaces=[
UsbInterface[mId=0,mAlternateSetting=0,mName=null,mClass=255,mSubclass=255,mProtocol=0,mEndpoints=[
UsbEndpoint[mAddress=129,mAttributes=2,mMaxPacketSize=1024,mInterval=0]
UsbEndpoint[mAddress=2,mAttributes=2,mMaxPacketSize=1024,mInterval=0]
UsbEndpoint[mAddress=131,mAttributes=3,mMaxPacketSize=2,mInterval=8]]]
UsbConfiguration[mId=2,mName=null,mAttributes=160,mMaxPower=36,mInterfaces=[
UsbInterface[mId=0,mAlternateSetting=0,mName=CDC Communications Control,mClass=2,mSubclass=6,mProtocol=0,mEndpoints=[
UsbEndpoint[mAddress=131,mAttributes=3,mMaxPacketSize=16,mInterval=8]]
UsbInterface[mId=1,mAlternateSetting=0,mName=null,mClass=10,mSubclass=0,mProtocol=0,mEndpoints=[]
UsbInterface[mId=1,mAlternateSetting=1,mName=Ethernet Data,mClass=10,mSubclass=0,mProtocol=0,mEndpoints=[
UsbEndpoint[mAddress=129,mAttributes=2,mMaxPacketSize=1024,mInterval=0]
UsbEndpoint[mAddress=2,mAttributes=2,mMaxPacketSize=1024,mInterval=0]]]]
2021-04-18 09:38:27.461 1682-2193/? D/EthernetTracker: Tracking interface in client mode: eth0
2021-04-18 09:38:27.461 1682-2193/? D/EthernetNetworkFactory: addInterface, iface: eth0, capabilities: [ Transports: ETHERNET Capabilities: NOT_METERED&INTERNET&NOT_RESTRICTED&TRUSTED&NOT_VPN&NOT_ROAMING&NOT_CONGESTED&NOT_SUSPENDED LinkUpBandwidth>=100000Kbps LinkDnBandwidth>=100000Kbps AdministratorUids: [] RequestorUid: -1 RequestorPackageName: null]
2021-04-18 09:38:27.466 1682-2193/? D/EthernetNetworkFactory: updateCapabilityFilter: [ Transports: ETHERNET Capabilities: NOT_METERED&INTERNET&NOT_RESTRICTED&TRUSTED&NOT_VPN&NOT_ROAMING&NOT_CONGESTED&NOT_SUSPENDED LinkUpBandwidth>=100000Kbps LinkDnBandwidth>=100000Kbps AdministratorUids: [] RequestorUid: -1 RequestorPackageName: null]

I can see in the above that pixel has got the UsbDevice (interface / endpoint) config and the network stack has sort of kicked in and the ethernet connection works.

Logs from experimental nanoPi based dongle (this wont pick up the ethernet connection):

2021-04-18 09:45:23.570 1682-2136/? I/UsbPortManager: ClientCallback V1_2: port0
2021-04-18 09:45:24.068 1682-1808/? I/EthernetTracker: interfaceLinkStateChanged, iface: usb0, up: false
2021-04-18 09:45:24.076 1682-2238/? W/UsbDescriptorParser: Unparsed Class-specific
2021-04-18 09:45:24.076 1682-2238/? I/chatty: uid=1000(system) UsbService host identical 2 lines
2021-04-18 09:45:24.076 1682-2238/? W/UsbDescriptorParser: Unparsed Class-specific
2021-04-18 09:45:24.077 1682-2238/? D/UsbHostManager: USB device attached: vidpid 30f8:abcd mfg/product/ver/serial **/** Dongle/1.00/A5EC1234567890 hasAudio/HID/Storage: false/false/false
2021-04-18 09:45:24.078 1682-2238/? D/UsbDeviceDescriptor: 1 configs
2021-04-18 09:45:24.080 1682-2238/? D/UsbHostManager: Added device UsbDevice[mName=/dev/bus/usb/001/002,mVendorId=12536,mProductId=43981,mClass=0,mSubclass=0,mProtocol=0,mManufacturerName=**,mProductName=** Dongle,mVersion=1.00,mSerialNumberReader=com.android.server.usb.UsbSerialReader@2afc73a, mHasAudioPlayback=false, mHasAudioCapture=false, mHasMidi=false, mHasVideoCapture=false, mHasVideoPlayback=false, mConfigurations=[
UsbConfiguration[mId=1,mName=CDC,mAttributes=128,mMaxPower=50,mInterfaces=[
UsbInterface[mId=0,mAlternateSetting=0,mName=CDC Network Control Model (NCM),mClass=2,mSubclass=13,mProtocol=0,mEndpoints=[
UsbEndpoint[mAddress=130,mAttributes=3,mMaxPacketSize=16,mInterval=9]]
UsbInterface[mId=1,mAlternateSetting=0,mName=CDC Network Data,mClass=10,mSubclass=0,mProtocol=1,mEndpoints=[]
UsbInterface[mId=1,mAlternateSetting=1,mName=CDC Network Data,mClass=10,mSubclass=0,mProtocol=1,mEndpoints=[
UsbEndpoint[mAddress=129,mAttributes=2,mMaxPacketSize=512,mInterval=0]
UsbEndpoint[mAddress=1,mAttributes=2,mMaxPacketSize=512,mInterval=0]]]]
2021-04-18 09:45:24.789 3006-3493/? D/MIDIDriver: unsupported interface: UsbInterface[mId=0,mAlternateSetting=0,mName=CDC Network Control Model (NCM),mClass=2,mSubclass=13,mProtocol=0,mEndpoints=[
UsbEndpoint[mAddress=130,mAttributes=3,mMaxPacketSize=16,mInterval=9]]
2021-04-18 09:45:24.790 3006-3493/? D/MIDIDriver: unsupported interface: UsbInterface[mId=0,mAlternateSetting=0,mName=CDC Network Control Model (NCM),mClass=2,mSubclass=13,mProtocol=0,mEndpoints=[
UsbEndpoint[mAddress=130,mAttributes=3,mMaxPacketSize=16,mInterval=9]]
2021-04-18 09:45:24.790 3006-3493/? D/MIDIDriver: unsupported interface: UsbInterface[mId=1,mAlternateSetting=0,mName=CDC Network Data,mClass=10,mSubclass=0,mProtocol=1,mEndpoints=[]
2021-04-18 09:45:24.791 3006-3493/? D/MIDIDriver: unsupported interface: UsbInterface[mId=1,mAlternateSetting=0,mName=CDC Network Data,mClass=10,mSubclass=0,mProtocol=1,mEndpoints=[]
2021-04-18 09:45:24.791 3006-3493/? D/MIDIDriver: unsupported interface: UsbInterface[mId=1,mAlternateSetting=1,mName=CDC Network Data,mClass=10,mSubclass=0,mProtocol=1,mEndpoints=[
UsbEndpoint[mAddress=129,mAttributes=2,mMaxPacketSize=512,mInterval=0]
UsbEndpoint[mAddress=1,mAttributes=2,mMaxPacketSize=512,mInterval=0]]
2021-04-18 09:45:24.791 3006-3493/? D/MIDIDriver: unsupported interface: UsbInterface[mId=1,mAlternateSetting=1,mName=CDC Network Data,mClass=10,mSubclass=0,mProtocol=1,mEndpoints=[
UsbEndpoint[mAddress=129,mAttributes=2,mMaxPacketSize=512,mInterval=0]
UsbEndpoint[mAddress=1,mAttributes=2,mMaxPacketSize=512,mInterval=0]]
202

From these logs i see that the android system has tried the interfaces and has not liked any one of them, I couldnt track down where in the Android source file does this check gets carried out or the reason for not liking them, I've looked into UsbHostManager, UsbPortManager and those classes.

The nanoPi runs a linux.

Any help will be appreciated. Please ask if there is some information that I can include but have missed.

Thanks,

A