如何在安装Android手机时自动弹出驱动程序磁盘?

我有一部阿尔卡特One Touch 4045D安卓手机。

在我将ID添加到/lib/udev/rules.d/69-libmtp.rules之前,它没有安装在Ubuntu中。

但手机上安装的是“USB Driver”CD。 如果我弹出那张CD,那么手机正常安装。

看起来手机固件试图检测是否安装了某个驱动程序,如果没有安装驱动程序的磁盘。

udev规则中是否有选项可以自动弹出此磁盘?

输出lsusb; lsusb -t & udevadm monitor -u 插入手机时lsusb; lsusb -t & udevadm monitor -u

 Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 002 Device 002: ID 048d:1336 Integrated Technology Express, Inc. SD/MMC Cardreader Bus 002 Device 003: ID 1bbb:af00 T & A Mobile Phones Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 001 Device 002: ID 04b8:0898 Seiko Epson Corp. Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 004 Device 002: ID 046d:c05a Logitech, Inc. M90/M100 Optical Mouse Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub [1] 10998 monitor will print the received events for: UDEV - the event which udev sends out after rule processing /: Bus 07.Port 1: Dev 1, Class=root_hub, Driver=ohci-pci/2p, 12M /: Bus 06.Port 1: Dev 1, Class=root_hub, Driver=ohci-pci/3p, 12M /: Bus 05.Port 1: Dev 1, Class=root_hub, Driver=ohci-pci/3p, 12M /: Bus 04.Port 1: Dev 1, Class=root_hub, Driver=ohci-pci/3p, 12M |__ Port 1: Dev 2, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M /: Bus 03.Port 1: Dev 1, Class=root_hub, Driver=ohci-pci/3p, 12M /: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/6p, 480M |__ Port 1: Dev 3, If 0, Class=Mass Storage, Driver=usb-storage, 480M |__ Port 3: Dev 2, If 0, Class=Mass Storage, Driver=usb-storage, 480M /: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/6p, 480M |__ Port 2: Dev 2, If 0, Class=Vendor Specific Class, Driver=, 480M |__ Port 2: Dev 2, If 1, Class=Printer, Driver=usblp, 480M |__ Port 2: Dev 2, If 2, Class=Mass Storage, Driver=usb-storage, 480M 

这是我弹出CD时的输出:

 UDEV [44405.211303] remove /devices/pci0000:00/0000:00:13.2/usb2/2-1/2-1:1.0/host10/target10:0:0/10:0:0:0/bsg/10:0:0:0 (bsg) UDEV [44405.212494] remove /devices/pci0000:00/0000:00:13.2/usb2/2-1/2-1:1.0/host10/target10:0:0/10:0:0:0/scsi_device/10:0:0:0 (scsi_device) UDEV [44405.212539] remove /devices/virtual/bdi/8:64 (bdi) UDEV [44405.212817] remove /devices/pci0000:00/0000:00:13.2/usb2/2-1/2-1:1.0/host10/target10:0:0/10:0:0:0/scsi_disk/10:0:0:0 (scsi_disk) UDEV [44405.214150] remove /devices/pci0000:00/0000:00:13.2/usb2/2-1/2-1:1.0/host10/target10:0:0/10:0:0:0/scsi_generic/sg5 (scsi_generic) UDEV [44405.214811] remove /devices/pci0000:00/0000:00:13.2/usb2/2-1/2-1:1.0/host10/target10:0:0/10:0:0:0/block/sde (block) UDEV [44405.216890] remove /devices/pci0000:00/0000:00:13.2/usb2/2-1/2-1:1.0/host10/target10:0:0/10:0:0:0 (scsi) UDEV [44405.232937] remove /devices/pci0000:00/0000:00:13.2/usb2/2-1/2-1:1.0/host10/target10:0:0/10:0:0:1/bsg/10:0:0:1 (bsg) UDEV [44405.233453] remove /devices/pci0000:00/0000:00:13.2/usb2/2-1/2-1:1.0/host10/target10:0:0/10:0:0:1/scsi_generic/sg6 (scsi_generic) UDEV [44405.234138] remove /devices/pci0000:00/0000:00:13.2/usb2/2-1/2-1:1.0/host10/target10:0:0/10:0:0:1/block/sr1 (block) UDEV [44405.235900] remove /devices/virtual/bdi/11:1 (bdi) UDEV [44405.236151] remove /devices/pci0000:00/0000:00:13.2/usb2/2-1/2-1:1.0/host10/target10:0:0/10:0:0:1/scsi_device/10:0:0:1 (scsi_device) UDEV [44405.237304] remove /devices/pci0000:00/0000:00:13.2/usb2/2-1/2-1:1.0/host10/target10:0:0/10:0:0:1 (scsi) UDEV [44405.238416] remove /devices/pci0000:00/0000:00:13.2/usb2/2-1/2-1:1.0/host10/target10:0:0 (scsi) UDEV [44405.260852] remove /devices/pci0000:00/0000:00:13.2/usb2/2-1/2-1:1.0/host10/scsi_host/host10 (scsi_host) UDEV [44405.261862] remove /devices/pci0000:00/0000:00:13.2/usb2/2-1/2-1:1.0/host10 (scsi) UDEV [44405.262597] remove /devices/pci0000:00/0000:00:13.2/usb2/2-1/2-1:1.0 (usb) UDEV [44405.267755] remove /devices/pci0000:00/0000:00:13.2/usb2/2-1 (usb) UDEV [44405.650792] add /devices/pci0000:00/0000:00:13.2/usb2/2-1 (usb) UDEV [44405.652229] add /devices/pci0000:00/0000:00:13.2/usb2/2-1/2-1:1.0 (usb) 

  1. 创建新规则文件:

     sudo nano /etc/udev/rules.d/99-eject-virtual-cd.rules 
  2. 添加此规则

     ACTION=="add", KERNEL=="sr[0-9]*", ATTRS{idVendor}=="1bbb", ATTRS{idProduct}=="af00", RUN+="/bin/sh -c 'eject /dev/%k'" 
  3. 重新加载规则

     sudo udevadm control -R 
  4. 重新插上手机进行检查