Load partially USB composite device

loïc tourlonias loic.tourlonias at gmail.com
Wed Aug 9 01:25:48 EDT 2017


Hi everybody,

In my project I have an USB composite device (a LTE modem) which use
USB to communicate with the processor. This device has several
interface to communicate but I do not use all of them. In particular,
it loads cdc_ether device which I don't use and I have an undesired
ethXX which interferes with a service in my system.

To schematize, let's say my device is loaded on port 2 of usb1, I have
the following USB topology:
- 1-2:1.0: tty
- 1-2:1.1: tty
- 1-2:1.2: tty
- 1-2:1.3: tty
- 1-2:1.4: tty
- 1-2:1.5: eth (not desired)

Is there a way to prevent this specific ethXX to mount?

I've already tried to create a udev rules, but I don't manage to stop
the loading process.
Here is a summary of my tries:
1/ I couldn't use the /sys/bus/usb1/.../1-2/activated file in my udev
rule because it's an USB composite device and I want to use the tty
interfaces but not the eth interface

2/ I have tried to stop the udev loading process, but setting MODALIAS
environment variable to a NULL-string doesn(t do the trick and
last-rule udev option has been removed in my udev version (1.8.2).

3/ I have tried to create a custom environment variable IGNORE_ETH and
modify my last rule which run modprobe with the modalias variable. In
the logs I see that modprobe isn't called by udev rules, but the
cdc_ether device is loaded all the same.

4/ I have think of creating a stub cdc_ether driver and use the
/etc/modprobe.d/my_file.conf to preempt the loading for my specific
usb composite device but this solution is ugly and I'm not sure it
will work.

Any idea will be great.
Best Regads
Loic



More information about the Kernelnewbies mailing list