Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Kernel & Hardware
  • Search

How to associate ETH number with USB port number for Huawei?

Kernel not recognizing your hardware? Problems with power management or PCMCIA? What hardware is compatible with Gentoo? See here. (Only for kernels supported by Gentoo.)
Post Reply
Advanced search
11 posts • Page 1 of 1
Author
Message
orion777
Apprentice
Apprentice
Posts: 207
Joined: Wed Mar 15, 2017 11:05 am
Location: Riga, Latvia

How to associate ETH number with USB port number for Huawei?

  • Quote

Post by orion777 » Fri Nov 24, 2017 3:49 pm

Good day!
I'm using more than one 4G Huawei 3372h modems. These dongles mode of operation is HiLink, so I have to use usb_modeswitch to operate them. The problem is that these dongles are one-by-one copies.. there are no any differences in ether, serial number and so.. and there are no possibilities to change serial or ether.
When the system is booted, dongles are recognized as eth1, eth2, ... but the numbering is always random, depending on how fast modem is connected to the cellular network.

I want to hardly associate USB PORT numbers with eth numbers (to be able to specify static IP settings).

This link https://askubuntu.com/questions/49910/h ... l-adapters says that it is possible to recognize two identical devices by using USB Port numbers. However, I am newbee and cant understand HOW to do this..

I'm trying to run lsusb, but the dongle is always recognized as a device 005 independently on what usb port is used (You can replug, but after restart it becomes 005 again).

Code: Select all

pi64 /etc # lsusb
Bus 001 Device 005: ID 12d1:14dc Huawei Technologies Co., Ltd. E33372 LTE/UMTS/GSM HiLink Modem/Networkcard
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. SMC9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
I was trying to run pi64 /etc/udev/rules.d # udevadm monitor --udev --property to understand what port is used, but seems that the Huawei 3372h in HiLink mode does not build any ttyUSB or so..
https://paste.pound-python.org/show/qHz ... UylX9M12t/

It will be great to get some help, advises or some links to read.. Please remember that I;m not an experience linux user and udev man does not have examples on device mapping based on USB port number.
Top
krinn
Watchman
Watchman
User avatar
Posts: 7476
Joined: Fri May 02, 2003 6:14 am

  • Quote

Post by krinn » Fri Nov 24, 2017 5:03 pm

you should plug 2 of them at least when showing the result, to see if really your assertion is true ; because network device do use their mac address to carry informations, and as such, two identical mac address would flaw the communication.
once two are plug, just show udevadm info -qall /sys/class/net/eth* result
Top
orion777
Apprentice
Apprentice
Posts: 207
Joined: Wed Mar 15, 2017 11:05 am
Location: Riga, Latvia

  • Quote

Post by orion777 » Fri Nov 24, 2017 7:38 pm

eth0 is build-in Raspberry pi 3B ethernet.

Both dongles are connected and are recognized as eth1 and eth2 respectively.

As I understood, udevadm info -qall /sys/class/net/eth* * symbol should to be replaced with 1 or 2, as * symbol returns eth0 only. So here is eth1 and eth2 reports:

Code: Select all

pi64 ~ # udevadm info -qall /sys/class/net/eth1
P: /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.5/1-1.5:1.0/net/eth1
E: DEVPATH=/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.5/1-1.5:1.0/net/eth1
E: ID_BUS=usb
E: ID_MM_CANDIDATE=1
E: ID_MM_HUAWEI_NDISDUP_SUPPORTED=1
E: ID_MODEL=HUAWEI_MOBILE
E: ID_MODEL_ENC=HUAWEI_MOBILE
E: ID_MODEL_FROM_DATABASE=E33372 LTE/UMTS/GSM HiLink Modem/Networkcard
E: ID_MODEL_ID=14dc
E: ID_NET_NAME_MAC=enx0c5b8f279a64
E: ID_REVISION=0102
E: ID_SERIAL=HUAWEI_MOBILE_HUAWEI_MOBILE
E: ID_TYPE=generic
E: ID_USB_CLASS_FROM_DATABASE=Communications
E: ID_USB_DRIVER=cdc_ether
E: ID_USB_INTERFACES=:020600:0a0600:080650:
E: ID_USB_INTERFACE_NUM=00
E: ID_VENDOR=HUAWEI_MOBILE
E: ID_VENDOR_ENC=HUAWEI_MOBILE
E: ID_VENDOR_FROM_DATABASE=Huawei Technologies Co., Ltd.
E: ID_VENDOR_ID=12d1
E: IFINDEX=4
E: INTERFACE=eth1
E: SUBSYSTEM=net
E: USEC_INITIALIZED=14388886

pi64 ~ # udevadm info -qall /sys/class/net/eth2
P: /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4/1-1.4:1.0/net/eth2
E: DEVPATH=/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4/1-1.4:1.0/net/eth2
E: ID_BUS=usb
E: ID_MM_CANDIDATE=1
E: ID_MM_HUAWEI_NDISDUP_SUPPORTED=1
E: ID_MODEL=HUAWEI_MOBILE
E: ID_MODEL_ENC=HUAWEI_MOBILE
E: ID_MODEL_FROM_DATABASE=E33372 LTE/UMTS/GSM HiLink Modem/Networkcard
E: ID_MODEL_ID=14dc
E: ID_NET_NAME_MAC=enx0c5b8f279a64
E: ID_REVISION=0102
E: ID_SERIAL=HUAWEI_MOBILE_HUAWEI_MOBILE
E: ID_TYPE=generic
E: ID_USB_CLASS_FROM_DATABASE=Communications
E: ID_USB_DRIVER=cdc_ether
E: ID_USB_INTERFACES=:020600:0a0600:080650:
E: ID_USB_INTERFACE_NUM=00
E: ID_VENDOR=HUAWEI_MOBILE
E: ID_VENDOR_ENC=HUAWEI_MOBILE
E: ID_VENDOR_FROM_DATABASE=Huawei Technologies Co., Ltd.
E: ID_VENDOR_ID=12d1
E: IFINDEX=5
E: INTERFACE=eth2
E: SUBSYSTEM=net
E: USEC_INITIALIZED=15256471

And here is lsusb:

Code: Select all

pi64 ~ # lsusb
Bus 001 Device 008: ID 12d1:14dc Huawei Technologies Co., Ltd. E33372 LTE/UMTS/GSM HiLink Modem/Networkcard
Bus 001 Device 006: ID 12d1:14dc Huawei Technologies Co., Ltd. E33372 LTE/UMTS/GSM HiLink Modem/Networkcard
Bus 001 Device 004: ID 1c4f:0002 SiGma Micro Keyboard TRACER Gamma Ivory
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. SMC9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
So now, seems we know usb port numbers! )) However, I don't know what to further..
Top
depontius
Advocate
Advocate
Posts: 3533
Joined: Wed May 05, 2004 4:06 pm

  • Quote

Post by depontius » Fri Nov 24, 2017 9:29 pm

I'm sorry, but here is where it is necessary to throw in a snide comment. Good old "eth numbers" are obsolete, because we're in the brave new world of "persistent, predictable device names." The only problem is that they are neither persistent nor predictable, especially where USB devices are concerned. They give a device name based on device enumeration, except that especially with USB, device enumeration can and will change depending on which devices are plugged in, and which ports they're plugged in to.

The ONLY thing that can give persistent device names is the MAC, and generally the MAC is printed somewhere on the packaging, meaning that it's predictable, too.

Please pardon the rant. BTW, I'm still using eth-names.
.sigs waste space and bandwidth
Top
orion777
Apprentice
Apprentice
Posts: 207
Joined: Wed Mar 15, 2017 11:05 am
Location: Riga, Latvia

  • Quote

Post by orion777 » Sat Nov 25, 2017 8:11 am

depontius, Yes here is the problem what I'm talking about! As MAC-addresses are same, NetworkManager sometimes is confusing, nmtui combines eth1 and eth2 as single wired connection 2. However, on my gentoo 64 up to three dongles with the same MAC works simultaneously: the problem is that I have to plug them one after another, othervice eth nembers will be randomly assigned or dongles may fail to get DHCP assigned IPs.

So I suppose that I can't use networkmanager configured by nmtui if I want to get predictable configuration (as it is based on MACs). I found some solution in ubuntu forum, how to connect two identical usb-to-serial converters:

Code: Select all

KERNEL=="ttyUSB*", KERNELS=="1-8.1.5", NAME="ttyUSB0"
KERNEL=="ttyUSB*", KERNELS=="1-8.1.6", NAME="ttyUSB1"
https://askubuntu.com/questions/49910/h ... l-adapters

As can be seen from udevadm info -qall /sys/class/net/eth1 AND 2, USB ports numbers can be determinated:

Code: Select all

pi64 ~ # udevadm info -qall /sys/class/net/eth1
P: /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.5/1-1.5:1.0/net/eth1
E: DEVPATH=/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.5/1-1.5:1.0/net/eth1

Code: Select all

pi64 ~ # udevadm info -qall /sys/class/net/eth2
P: /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4/1-1.4:1.0/net/eth2
E: DEVPATH=/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4/1-1.4:1.0/net/eth2
The problem is that Hiawei 3372h does not build any ttyUSB* (at least I cant find them). So the question is: will it work if I will specify this:

Code: Select all

KERNEL=="eth*", KERNELS=="1-1.5:1.0", NAME="eth1"

and, if it will work, than, probably, I have to remove NetworkManager, and manually assign all configuration in /etc/conf.d/net as is shown here https://wiki.gentoo.org/wiki/Handbook:X ... Networking ??
Top
krinn
Watchman
Watchman
User avatar
Posts: 7476
Joined: Fri May 02, 2003 6:14 am

  • Quote

Post by krinn » Sat Nov 25, 2017 11:45 am

Well, try, it should be more aim to net subsystem and more aim to only be apply to that device and not any device plug-in that port, so something more like

Code: Select all

SUBSYSTEM=="net", ACTION=="add", ENV{ID_MODEL_ID}=="14dc" KERNEL=="eth*", KERNELS=="1-1.5:1.0", NAME="myeth1"
udevadm test /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.5/1-1.5:1.0/net/eth1
also as you might note, i'm naming it "myeth1", because you don't know if eth1 will be taken or not by another device, and trying to rename to eth1 would fail if taken already.

Expect result from udevadm test:
You should see: changing net interface name from 'eth1' to 'myeth1'
Top
depontius
Advocate
Advocate
Posts: 3533
Joined: Wed May 05, 2004 4:06 pm

  • Quote

Post by depontius » Sat Nov 25, 2017 12:07 pm

orion777 wrote:depontius, Yes here is the problem what I'm talking about! As MAC-addresses are same,
I don't think that that's legally allowed to happen. They can certainly be the exact same model number, even purchased and manufactured at the same time. But the MACs need to be distinct. A quick search with the terms "gentoo udev rule mac" will give decent hits. (No quotes on the search bar)
.sigs waste space and bandwidth
Top
krinn
Watchman
Watchman
User avatar
Posts: 7476
Joined: Fri May 02, 2003 6:14 am

  • Quote

Post by krinn » Sat Nov 25, 2017 12:10 pm

As stupid and surprising as it is, its mac are indeed identical, making this device a real poorly made one.

Code: Select all

E: ID_NET_NAME_MAC=enx0c5b8f279a64 
Top
orion777
Apprentice
Apprentice
Posts: 207
Joined: Wed Mar 15, 2017 11:05 am
Location: Riga, Latvia

  • Quote

Post by orion777 » Sat Nov 25, 2017 8:04 pm

Ok, I was trying to do it as follows:
1) make my .rules:

Code: Select all

 pi64 ~ # cat /etc/udev/rules.d/70-my-network.rules
SUBSYSTEM=="net", ACTION=="add", ENV{ID_MODEL_ID}=="14dc" KERNEL=="eth*", KERNELS=="1-1.4:1.0", NAME="eth3" 
2) rebooting and plugging dongle into 1-1.4:1.0 port
However, its name becomes eth1, NOT eth3 as specified in 70-my-network.rules ... Maybe NetworkManager overrides this rule?

Code: Select all

pi64 ~ # udevadm info -qall /sys/class/net/eth1
P: /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4/1-1.4:1.0/net/eth1
E: DEVPATH=/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4/1-1.4:1.0/net/eth1
E: ID_BUS=usb
E: ID_MM_CANDIDATE=1
E: ID_MM_HUAWEI_NDISDUP_SUPPORTED=1
E: ID_MODEL=HUAWEI_MOBILE
E: ID_MODEL_ENC=HUAWEI_MOBILE
E: ID_MODEL_FROM_DATABASE=E33372 LTE/UMTS/GSM HiLink Modem/Networkcard
E: ID_MODEL_ID=14dc
E: ID_NET_NAME_MAC=enx0c5b8f279a64
E: ID_REVISION=0102
E: ID_SERIAL=HUAWEI_MOBILE_HUAWEI_MOBILE
E: ID_TYPE=generic
E: ID_USB_CLASS_FROM_DATABASE=Communications
E: ID_USB_DRIVER=cdc_ether
E: ID_USB_INTERFACES=:020600:0a0600:080650:
E: ID_USB_INTERFACE_NUM=00
E: ID_VENDOR=HUAWEI_MOBILE
E: ID_VENDOR_ENC=HUAWEI_MOBILE
E: ID_VENDOR_FROM_DATABASE=Huawei Technologies Co., Ltd.
E: ID_VENDOR_ID=12d1
E: IFINDEX=4
E: INTERFACE=eth1
E: SUBSYSTEM=net
E: USEC_INITIALIZED=125867763
Also

Code: Select all

udevadm test /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4/1-1.4:1.0/net/eth3
returns

Code: Select all

unable to open device '/sys/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4/1-1.4:1.0/net/eth3'
Unload module index
but it work when eth1 is specified..

Code: Select all

rules contain 98304 bytes tokens (8192 * 12 bytes), 22968 bytes strings
8780 strings (88086 bytes), 7189 de-duplicated (66710 bytes), 1592 trie nodes used
IMPORT builtin 'net_id' /lib/udev/rules.d/75-net-description.rules:6
IMPORT builtin 'usb_id' /lib/udev/rules.d/75-net-description.rules:8
/sys/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4/1-1.4:1.0: if_class 2 protocol 0
IMPORT builtin 'hwdb' /lib/udev/rules.d/75-net-description.rules:8
RUN 'net.sh $name start' /lib/udev/rules.d/90-network.rules:6
created db file '/run/udev/data/n4' for '/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4/1-1.4:1.0/net/eth1'
.MM_USBIFNUM=00
ACTION=add
DEVPATH=/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4/1-1.4:1.0/net/eth1
ID_BUS=usb
ID_MM_CANDIDATE=1
ID_MM_HUAWEI_NDISDUP_SUPPORTED=1
ID_MODEL=HUAWEI_MOBILE
ID_MODEL_ENC=HUAWEI_MOBILE
ID_MODEL_FROM_DATABASE=E33372 LTE/UMTS/GSM HiLink Modem/Networkcard
ID_MODEL_ID=14dc
ID_NET_NAME_MAC=enx0c5b8f279a64
ID_REVISION=0102
ID_SERIAL=HUAWEI_MOBILE_HUAWEI_MOBILE
ID_TYPE=generic
ID_USB_CLASS_FROM_DATABASE=Communications
ID_USB_DRIVER=cdc_ether
ID_USB_INTERFACES=:020600:0a0600:080650:
ID_USB_INTERFACE_NUM=00
ID_VENDOR=HUAWEI_MOBILE
ID_VENDOR_ENC=HUAWEI_MOBILE
ID_VENDOR_FROM_DATABASE=Huawei Technologies Co., Ltd.
ID_VENDOR_ID=12d1
IFINDEX=4
INTERFACE=eth1
SUBSYSTEM=net
USEC_INITIALIZED=91807368
run: 'net.sh eth1 start'
Unload module index
Top
orion777
Apprentice
Apprentice
Posts: 207
Joined: Wed Mar 15, 2017 11:05 am
Location: Riga, Latvia

  • Quote

Post by orion777 » Mon Nov 27, 2017 6:00 pm

I dont know why, but it work only as follows:

Code: Select all

pi64 /etc/udev/rules.d # cat 70-etc3.rules
KERNELS=="1-1.4:1.0", NAME="eth3"
All other parameters, such as KERNEL, seems not working..
Top
orion777
Apprentice
Apprentice
Posts: 207
Joined: Wed Mar 15, 2017 11:05 am
Location: Riga, Latvia

  • Quote

Post by orion777 » Mon Nov 27, 2017 6:15 pm

One more question: if I wish to use config in /etc/conf.d/net , than I have to disable network manager? As NetworkManager stores configs in /etc/NetworkManager/system-connections , but net file in /etc/conf.d/ does not exist.
Top
Post Reply

11 posts • Page 1 of 1

Return to “Kernel & Hardware”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic