user169337
user169337

Reputation: 93

Load cdc_acm module only for specific usb interface

I am trying USB device, which represents itself with multiple (seven) USB subinterfaces, for each one is loaded cdc_acm kernel module. cdc_acm module reports "no more free acm devices", when I am trying to connect more USB devices.

I have tried udev rules but without success.

ACTION=="add", SUBSYSTEMS=="usb", DRIVERS=="cdc_acm", ATTRS{bInterfaceNumber}!="00", RUN+="/bin/sh -c 'echo -n $id > /sys/bus/usb/drivers/cdc_acm/unbind'"

This rule unbinds cdc_acm driver, but it happens after driver detects all subinterfaces and run into free space issue.

I am looking for the way how to load cdc_acm driver only for one SUB subinterface.

Upvotes: 1

Views: 2921

Answers (1)

David Grayson
David Grayson

Reputation: 87376

You can see where the "no more free acm devices" message comes from in the source code of cdc_acm:

http://lxr.free-electrons.com/source/drivers/usb/class/cdc-acm.c#L1320

After looking at that code for a little bit, it looks like the cdc_acm driver has a table that can only hold 32 entries, and when the table fills up then you will get that error message. The size of the table is determined by the ACM_TTY_MINORS macro in cdc-acm.h.

You might be able to solve your problem by recompiling the cdc-acm module with a higher value for ACM_TTY_MINORS, and then loading it into your kernel.

Recompiling a kernel module is a pretty involved process. I have done it before but I don't know all the details off the top of my head. Many other people have done it in other contexts, so you should be able to search for things "recompiling a Linux kernel module" to find good tutorials on it.

Upvotes: 1

Related Questions