Saturday, May 4, 2024
 Popular · Latest · Hot · Upcoming
7
rated 0 times [  7] [ 0]  / answers: 1 / hits: 9863  / 1 Year ago, sun, april 23, 2023, 4:19:53

I am trying to prevent modem manager from running when I plug my cell phone into a USB port.



I have tried to add a custom rule with udev, but my custom rules seem ignored. I created a file /etc/udev/rules.d/99-mm-usb-device-blacklist.rules which contains



# LG Phone
ATTRS{idVendor}=="1004", ENV{ID_MM_DEVICE_IGNORE}="1"


And yet when I plug in the phone and check dmesg, this is what I get:



[ 1809.761940] usb 3-1: new high-speed USB device number 11 using xhci_hcd
[ 1809.778662] usb 3-1: New USB device found, idVendor=1004, idProduct=61fc
[ 1809.778670] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1809.778674] usb 3-1: Product: B Project USB Device
[ 1809.778677] usb 3-1: Manufacturer: LG Electronics. Inc
[ 1809.778680] usb 3-1: SerialNumber: XXXXXXXXXXXXXXXXX
[ 1809.779501] cdc_acm 3-1:1.0: This device cannot do calls on its own. It is not a modem.
[ 1809.779584] cdc_acm 3-1:1.0: ttyACM0: USB ACM device
[ 1809.780899] cdc_ether 3-1:1.3 usb0: register 'cdc_ether' at usb-0000:00:14.0-1, CDC Ethernet Device, 6e:34:73:4f:68:4c
[ 1809.781454] scsi8 : usb-storage 3-1:1.5
[ 1809.807331] IPv6: ADDRCONF(NETDEV_UP): usb0: link is not ready
[ 1809.816566] IPv6: ADDRCONF(NETDEV_UP): usb0: link is not ready
[ 1809.816759] IPv6: ADDRCONF(NETDEV_UP): usb0: link is not ready


I have also tried editing /lib/udev/rules.dev/77-mm-usb-device-blacklist.rules but this did not work either. What am I missing? What would be a helpful step in debugging this?



Update:
Running udevadm info --export-db shows the udev rule is being updated. The relevant output is:



P: /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.7
N: bus/usb/002/012
E: BUSNUM=002
E: DEVNAME=/dev/bus/usb/002/012
E: DEVNUM=012
E: DEVPATH=/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.7
E: DEVTYPE=usb_device
E: DRIVER=usb
E: ID_BUS=usb
E: ID_MM_DEVICE_IGNORE=1
E: ID_MODEL=B_Project_USB_Device
E: ID_MODEL_ENC=Bx20Projectx20USBx20Device
E: ID_MODEL_ID=61fc
E: ID_REVISION=0216
E: ID_SERIAL=LG_Electronics._Inc_B_Project_USB_Device_XXXXXXXXXXXXX
E: ID_SERIAL_SHORT=XXXXXXXXXXXX
E: ID_USB_INTERFACES=:020201:0a0000:ffffff:020600:080650:
E: ID_VENDOR=LG_Electronics._Inc
E: ID_VENDOR_ENC=LGx20Electronics.x20Inc
E: ID_VENDOR_ID=1004
E: MAJOR=189
E: MINOR=139
E: PRODUCT=1004/61fc/216
E: SUBSYSTEM=usb
E: TYPE=239/2/1
E: UDEV_LOG=7
E: USEC_INITIALIZED=5987581808


So modem manager should be ignoring the device. And yet my computer keeps trying to initialize a network connect through my phone whenever I plug it to the USB port. Is there another program that udev is launching?


More From » usb

 Answers
5

While there may be a way to do this with udev, I found a much simpler working solution at this AskUbuntu question.



To summarize, you can tell Network Manager not to manage certain devices by adding a line to its .conf file.



First, find your cell phone's mac address. Run dmesg from the terminal after you plug it in; one of the print outs should have the mac. The line for me was:



[ 4691.112016] cdc_ether 3-1:1.3 usb0: register 'cdc_ether' at usb-0000:00:14.0-1, CDC Ethernet Device, de:1a:28:c7:db:e6


Next, open /etc/NetworkManager/NetworkManager.conf with super user privledges, and add a your phone's mac as an unmanaged device. This is my NetworkManager.conf; I added the last two lines.



[main]
plugins=ifupdown,keyfile
dns=dnsmasq

[ifupdown]
managed=false

[keyfile]
unmanaged-devices=mac:de:1a:28:c7:db:e6

[#27697] Monday, April 24, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
percol

Total Points: 493
Total Questions: 116
Total Answers: 107

Location: Taiwan
Member since Mon, Sep 6, 2021
3 Years ago
;