OpenWrt Forum Archive

Topic: solved: cdc-ether

The content of this topic has been archived on 27 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi!
Router: TP-Link TL-MR3020 v1
Modem: Huawei e3372 (HiLink firmware)
OpenWRT version: Barrier Breaker 14.07 (stable, from here http://downloads.openwrt.org/barrier_breaker/14.07)
My actions: step by step
1) First of all I flash my router with BB 14.07
2) My PC connected with ethernet to eth0 of router
3) Internet connection through WiFi module in client mode
4) opkg update (success)
    okpg install kmod-usb-net kmod-usb-net-cdc-ether (success)
dmesg output after it:

[  769.890000] cdc_ether 1-1:1.0: eth1: register 'cdc_ether' at usb-ehci-platform-1, CDC Ethernet Device, 0c:5b:8f:27:9a:64
[  769.900000] usbcore: registered new interface driver cdc_ether

5) Then I unplug the modem
dmesg:

[  819.340000] usb 1-1: USB disconnect, device number 2
[  819.350000] cdc_ether 1-1:1.0: eth1: unregister 'cdc_ether' usb-ehci-platform-1, CDC Ethernet Device

6) And then I plug it in back
dmesg:

[  837.470000] usb 1-1: new high-speed USB device number 3 using ehci-platform

And nothing else...
I tried to reboot router with modem plugged without result.
In addition: ROOter firmware (http://ofmodemsandmen.com/ , openwrt based) works fine for me (many reboots and reconnects of modem without troubles)
Please, help me with advice or something like that. I have no more idea what to do.
Thank you.

(Last edited by fingerskillz on 12 Feb 2015, 10:38)

I've a Huawei E8278 working with OpenWRT on the Pi. If your device is similar the below should help.

I needed to ensure these packages were installed:

kmod-usb-net
kmod-usb-net-cdc-ether
kmod-usb-net-cdc-ncm
kmod-usb-serial
kmod-usb-serial-option
kmod-usb-serial-wwan
kmod-usb2
block-mount
udev
usb-modeswitch
usbutils

*caveat - not sure if all these are _actually_ required (eg kmod-usb-serial-wwan) but I haven't had the inclination to test, just happy the thing works.

After a restart dmesg should show the modem appearing as wwan0. If not perhaps issue usbmode -s and restart.

Then configure the adapter in /etc/config/network to get its IP from the device's DHCP server.

That won't work for me. It is for stick modems, not for hilink.
HiLink firmware transforms modem from usb-serial device to virtual ethernet adapter.
And dmesg "said" that cdc-ether is the right one driver. I don't think that there is trouble in package selection.
Maybe in config for kmod-usb-net-cdc-ether or load sequence or something else...

P.S. Tried with AA 12.09 - same

(Last edited by fingerskillz on 10 Feb 2015, 11:33)

No, the kmod-usb-net-cdc-ncm package, I think, is needed for HiLink devices. (there are a few links about describing set-up of Huawei dongles and some on the dev: https://dev.openwrt.org/ticket/15328) So instead of the device appearing as, say, eth1 it will appear as wwan0. I find that more helpful anyhow.

Give it a try. In CC there is a specific package for Huawei cdc devices (kmod-usb-net-huawei-cdc-ncm), which helps with the confusion, but with BB the above should work.

I got my device working under Debian (using cdc-ncm) and then realised that a similar set of packages were needed in OpenWRT to make it work.

(Last edited by tristanc on 10 Feb 2015, 11:47)

Oh, and I think your issue in the OP might also be related to missing a package to remount USB devices in a hot-plug fashion. I remember reading somewhere the need for block-mount and / or udev to ensure usb devices inserted after boot were dealt with correctly.

Also, make sure your /etc/config/network file is edited to deal with eth1 or wwan1 so it brings it up looking for an IP from a DHCP server (if it is like my device it will be given 192.168.1.100 and the gateway will be 192.168.1.1).

tristanc wrote:

Also, make sure your /etc/config/network file is edited to deal with eth1 or wwan1 so it brings it up looking for an IP from a DHCP server (if it is like my device it will be given 192.168.1.100 and the gateway will be 192.168.1.1).

When it works correcly (with usbcore: registered new interface driver cdc_ether in dmesg) I just use ifconfig -a and eth1 is there, where it doesn't work - there is no eth1.

tristanc wrote:

No, the kmod-usb-net-cdc-ncm package, I think, is needed for HiLink devices

In AA 12.09 there wasn't kmod-usb-net-cdc-ncm at the repos, but I could work with modem (for 3 or 4 reboots, then same thing with "invisible" cdc-ether)
Anyway, I'm very happy you help me. I'll try your advices.
And there is one addition to my trouble - sometimes (doesn't depends of anything) cdc-ether device doesn't work at all (right after installing kmod-usb-net-ether). I thought that's it hardware problem in router, and I should replace it with another one, but ROOter works fine!

fingerskillz wrote:

In AA 12.09 there wasn't kmod-usb-net-cdc-ncm at the repos, but I could work with modem (for 3 or 4 reboots, then same thing with "invisible" cdc-ether)

Hmm, strange. Perhaps yours is a differing implementation of HiLink?

fingerskillz wrote:

And there is one addition to my trouble - sometimes (doesn't depends of anything) cdc-ether device doesn't work at all (right after installing kmod-usb-net-ether). I thought that's it hardware problem in router, and I should replace it with another one, but ROOter works fine!

Again, strange. Let me know how it goes after installing those packages above.

tristanc wrote:

Again, strange. Let me know how it goes after installing those packages above.

If you say about

kmod-usb-net
kmod-usb-net-cdc-ether
kmod-usb-net-cdc-ncm
kmod-usb-serial
kmod-usb-serial-option
kmod-usb-serial-wwan
kmod-usb2
block-mount
udev
usb-modeswitch
usbutils

I can answer right now.
I tried that packages right after you recommend them to me. Unfortunately nothing happened.

With my device, I get a dmesg output similar, but without the errors, to this one:

https://bbs.archlinux.org/viewtopic.php?id=190154

With the packages installed, run usbmode -s, reboot and post your dmesg. I'll compare to mine later today and see if there is a difference. OK, so they are different devices but I'd expect some similarity.

(Last edited by tristanc on 10 Feb 2015, 13:56)

It looks like I solved the problem.
The only package that I installed in addition to kmod-usb-net-cdc-ether is ...
usb-modeswitch
Maybe router won't work so fine tomorrow, but now it do.
tristanc, thank you a lot.
I dunno, how it could not work before, when I tried your advice.
The way I got the solution is analyzing logread output at ROOter firmware and digging automated scripts for building "ROOter Huntsman". Thank you once again!
I'll post one message tomorrow to commit the solution in the internet for future generations smile

Excellent news. Let me know if it remains up and stable.

I chose OpenWRT to share a connection from a 4G dongle (remote location) but have yet to get all the 'bits' to work at once in a reliable way. The 4G bit seems to be the most stable. The USB wifi device the least...

It is stable......enough. Somehow (i have no any idea) I found my /etc/init.d/usbmode disabled today. So it didn't start at boot and my cdc-ether device wasn't found by cdc_ether module. After I enabled it again and reboot the device - router continue working stable.
I suppose, it is the single problem and it won't repeat again. I hope..

One more day passed. Still works.
Problem is solved.
Thank you much!

fingerskillz wrote:

It looks like I solved the problem.
The only package that I installed in addition to kmod-usb-net-cdc-ether is ...
usb-modeswitch
Maybe router won't work so fine tomorrow, but now it do.
tristanc, thank you a lot.
I dunno, how it could not work before, when I tried your advice.
The way I got the solution is analyzing logread output at ROOter firmware and digging automated scripts for building "ROOter Huntsman". Thank you once again!
I'll post one message tomorrow to commit the solution in the internet for future generations smile

is this setup still working for you?
I'm trying to get my Novatel U679 (Bell's Turbo Stick) working with OpenWRT CC RC2 and I'm at the step where I can see the usb stick as eth1 under my ifconfig -a interfaces. It disappears once I remove the USB device.
Could you share with me your /etc/config/network and /etc/config/firewall code?
Did you have to configure anything else?
my lsusb shows me:

Bus 001 Device 003: ID 1410:7031 Novatel Wireless


I've tried everything I could find regarding this type of setup and I've yet to make it work! sad

hello fingerskillz,

i have the same situation as you, and i have already installed the packages, but in vain. the modem e3372 can't get detected by the router.

what should i do plz to let it work ?

thank you very much

exotix wrote:

hello fingerskillz,

i have the same situation as you, and i have already installed the packages, but in vain. the modem e3372 can't get detected by the router.

what should i do plz to let it work ?

thank you very much

Hi! Is your modem in HiLink (usb ethernet emulation) mode?

exotix wrote:

hello fingerskillz,

i have the same situation as you, and i have already installed the packages, but in vain. the modem e3372 can't get detected by the router.

what should i do plz to let it work ?

thank you very much

My e3372 started works immediately, after I have installed cdc-ether and usb-modeswitch (in HiLink mode). It won't work in modem mode with that packages.

Hi !
I have huawei e3272s with HiLink firmware (22.491.03.00.00), i.e. it appears as usb ethernet card and as far as I understand does not need to be switched from cdrom-mode to modem-mode.
Anyway folowing fingerskillz message I installed usbmode-switch and its still not stable - sometimes eth2 appears, sometimes it does not.

I attach 2 logs from the same system - one time I have eth2, in another I have no eth2. Do you have any idea why?

log1 (doesnt work) http://pastebin.com/9J5yEkHJ
log2 (works) http://pastebin.com/76kMJuTZ

ps logs are generated with:
cat /etc/openwrt_version >> /tmp/mylist_installed
opkg list_installed >> /tmp/mylist_installed
lsmod >> /tmp/mylist_installed
dmesg >> /tmp/mylist_installed
logread >> /tmp/mylist_installed
ifconfig  >> /tmp/mylist_installed


Moreover, what is the difference between
kmod-usb-net-cdc-ether
kmod-usb-net-cdc-ncm
kmod-usb-net-huawei-cdc-ncm
kmod-usb-rndis
?

I believe I only need kmod-usb-net-cdc-ether ?
If I install kmod-usb-rndis i get usb0 instead of eth2 but it does not work as I cant get ip with dchp client for it. Why?

fingerskillz wrote:
exotix wrote:

hello fingerskillz,

i have the same situation as you, and i have already installed the packages, but in vain. the modem e3372 can't get detected by the router.

what should i do plz to let it work ?

thank you very much

Hi! Is your modem in HiLink (usb ethernet emulation) mode?

Hello fingerskillz,

yes, ther modem in HiLink (usb ethernet emulation) mode.

Looks like OpenWRT has support for this modem in non-hilink mode in package

kmod-usb-net-huawei-cdc-ncm

https://dev.openwrt.org/ticket/20103

Anyone tried this yet?

dDaYb wrote:

Moreover, what is the difference between
kmod-usb-net-cdc-ether
kmod-usb-net-cdc-ncm
kmod-usb-net-huawei-cdc-ncm
kmod-usb-rndis
?

Short story: They are all drivers for different devices.

But to make things more confusing: Some devices support multiple different modes, and are therefore capable of being driver by more than one of these drivers.  Which driver you want to use in such cases depend mostly on the modem firmware implementation of the different modes, so it's not possible to give generic recommendations like "driver X is bettwe than driver Y".

If you want more details then you can start by looking at /sys/kernel/debug/usb/devices with your modem plugged in.  For each device you'll see one or more (most likely many more) lines prefixed by "I:".  This is a representation of USB interface descriptors.

Some examples:

I:* If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=0d Prot=00 Driver=cdc_ncm

I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=05 Prot=10 Driver=(none)

I:* If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=06 Prot=00 Driver=cdc_ether

The USB-IF has defined different device classes, allowing generic class drivers to support a wide range of devices providing similar functions.  The Communication class (02) is one of these, which has been further divided in subclasses like ACM (abstract control model), ECM (ethernet control model), etc. There is also a protocol field, which is relevant for some subclasses. Class drivers have many advantages.  One of the most important is the ability to support future devices.

Then there is the vendor specific class (ff), intended for devices which doesn't match any of the predefined classes. Such devices will need device specific drivers, making support usually lag behind.  But there are excptions: Huawei use their own class scheme based on the subclass and protocol fields.  This allows the huawei-cdc-ncm driver to act as sort of a Huawei specfic "class driver".

And RNDIS is really a class defintion, but Microsoft never defined it properly through the USB-IF so it doesn't have it's own class codes.  But there are a limited set of non-standard codes which identify RNDIS functions.

So, to answer your question:

cdc-ether is a CDC ECM class (02/06/00) driver
cdc-ncm is a CDC NCM class (02/0d/00) driver
huawei-cdc-ncm is a Huawei vendor specific driver matching some of their "well known" NCM like functions, like ff/02/16
rndis is an RNDIS "class" driver, mathcing e.g. 02/02/ff devices

All of these drivers do further probing after the intial descriptor matching, verifying that the device actually is supported by that driver.  This helps a lot of you use the ability to dynamically add explicit USB device IDs to a driver.

The discussion might have continued from here.