Mascarpone
Mascarpone

Reputation: 2556

Prevent cdc-acm driver from loading device

I'm trying to connect a serial device with Webusb, under linux.

I have been able to list the device and open it, but I can't claim the interface. Chrome complains that the device is busy, and to fix that I need to unregister the CDC-ACM driver.

Is there a way to prevent the CDC-ACM driver from loading the device, without changes on the destkop? maybe I can change the USB descriptors?

Upvotes: 1

Views: 3288

Answers (2)

Roberto
Roberto

Reputation: 424

I have been able to unbind the cdc_acm interface after setup (write this in the last lines of the rules file) with this udev rule:

ATTR{idProduct}=="<mypid>", ATTR{idVendor}=="<myvid>", RUN="/bin/sh -c 'echo %k:1.0 > /sys/bus/usb/drivers/cdc_acm/unbind'"

This works seamlessly by unbinding the cdc_acm driver to the device having productId=<mypid> and vendorId=<myvid>.

Hope it helps.

Upvotes: 2

Reilly Grant
Reilly Grant

Reputation: 6093

If you can change the device descriptors then modify the protocol, class and sub-class reported by the CDC-ACM interface so that it is marked as vendor-specific (0xff). The CDC-ACM driver will no longer recognize the interface and bind to it.

Just for completeness, if you could make changes to the desktop then you can either blacklist the usb-serial driver entirely in /etc/modprobe.d/blacklist or you could write a udev rule which runs for that device in particular (recognized be either bus path or vendor and product ID) and executes a script to unbind the driver.

Upvotes: 2

Related Questions