Como ejetar automaticamente o disco do driver ao montar o telefone Android?

2

Eu tenho um telefone Android Alcatel One Touch 4045D.

Ele não foi instalado no Ubuntu até eu adicionar os IDs a /lib/udev/rules.d/69-libmtp.rules .

Mas o telefone é montado como um CD com "USB Driver". Se eu ejetar esse CD, o telefone é montado normalmente.

Parece que o firmware do telefone está tentando detectar se algum driver está instalado e se não é montado como um disco com o driver.

Existe uma opção nas regras do udev para ejetar automaticamente este disco?

Saída de lsusb; lsusb -t & udevadm monitor -u quando eu conecto o telefone:

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

Esta é a saída quando ejetei o 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)
    
por Pilot6 08.08.2015 / 12:59

1 resposta

1
  1. Crie um novo arquivo de regras:

    sudo nano /etc/udev/rules.d/99-eject-virtual-cd.rules
    
  2. Adicione esta regra

    ACTION=="add", KERNEL=="sr[0-9]*", ATTRS{idVendor}=="1bbb", ATTRS{idProduct}=="af00", RUN+="/bin/sh -c 'eject /dev/%k'"
    
  3. Recarregue as regras

    sudo udevadm control -R
    
  4. Substitua o telefone para verificar

por user.dz 25.08.2015 / 19:51