sole / aafm

Android ADB file manager
GNU General Public License v3.0
222 stars 50 forks source link

Does not detect device on first execution, but does on second #62

Open zymos opened 10 years ago

zymos commented 10 years ago

Ok, so I run aafm with my phone plugged in, and it gives 'error: device not found'. Then i run aafm again a second later, and it works.

Its probably a simple fix by adding a second scan with a delay on startup.

here is the output

First run

EXECUTE ('adb', 'devices') EXECUTE ('adb', '-s', '', 'shell', 'cat', '/system/build.prop') error: device not found EXECUTE ('adb', '-s', '', 'shell', 'cat', '/system/build.prop') error: device not found EXECUTE ('adb', '-s', '6a7165c6', 'shell', 'cat', '/system/build.prop') EXECUTE ('adb', '-s', '*', 'shell', 'ls', '--help') error: device not found EXECUTE ('adb', 'devices') EXECUTE ('adb', '-s', '6a7165c6', 'shell', 'cat', '/system/build.prop') EXECUTE ('adb', '-s', '6a7165c6', 'shell', 'ls', '--help') Traceback (most recent call last): File "/opt/aafm/src/aafm-gui.py", line 883, in gui = Aafm_GUI() File "/opt/aafm/src/aafm-gui.py", line 81, in init self.refresh_menu_devices() File "/opt/aafm/src/aafm-gui.py", line 177, in refresh_menu_devices self.refresh_device_files() File "/opt/aafm/src/aafm-gui.py", line 246, in refresh_device_files self.device_treeViewFile.load_data(self.dir_scan_device(self.aafm.device_cwd)) AttributeError: Aafm_GUI instance has no attribute 'device_treeViewFile'

Second run

EXECUTE ('adb', 'devices') EXECUTE ('adb', '-s', '6a7165c6', 'shell', 'cat', '/system/build.prop') EXECUTE ('adb', '-s', '6a7165c6', 'shell', 'ls', '--help') EXECUTE ('adb', 'devices') EXECUTE ('adb', '-s', '6a7165c6', 'shell', 'cat', '/system/build.prop') EXECUTE ('adb', '-s', '6a7165c6', 'shell', 'ls', '-l', '-a', '/mnt/external_sd/Audiobooks/') EXECUTE ('adb', '-s', '6a7165c6', 'shell', 'df', '/mnt/external_sd/Audiobooks')

Thanks for an awesome prog

sole commented 8 years ago

Does this always happen? (sorry for the long delay - I just don't have the bandwidth to attend to all projects)

It might just be that the adb server is not started on the first go... hmmm, yeah maybe your suggestion could work (I think the server starts when adb is called). I have no time to implement it, though. If anyone wants to have a go, feel free.

cb474 commented 8 years ago

I have had exactly this problem for many months now. The first time I try to run aafm it failes to execute. The second time it works. It always happens. I get similar messages.

1st run:

EXECUTE ('adb', 'devices')
EXECUTE ('adb', '-s', '*', 'shell', 'cat', '/system/build.prop')
error: device not found
EXECUTE ('adb', '-s', '*', 'shell', 'cat', '/system/build.prop')
error: device not found
EXECUTE ('adb', '-s', '0032569052087e14', 'shell', 'cat', '/system/build.prop')
EXECUTE ('adb', '-s', '*', 'shell', 'ls', '--help')
error: device not found
EXECUTE ('adb', 'devices')
EXECUTE ('adb', '-s', '0032569052087e14', 'shell', 'cat', '/system/build.prop')
EXECUTE ('adb', '-s', '0032569052087e14', 'shell', 'ls', '--help')
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/aafm/aafm-gui.py", line 880, in <module>
    gui = Aafm_GUI()
  File "/usr/lib/python2.7/site-packages/aafm/aafm-gui.py", line 78, in __init__
    self.refresh_menu_devices()
  File "/usr/lib/python2.7/site-packages/aafm/aafm-gui.py", line 174, in refresh_menu_devices
    self.refresh_device_files()
  File "/usr/lib/python2.7/site-packages/aafm/aafm-gui.py", line 243, in refresh_device_files
    self.device_treeViewFile.load_data(self.dir_scan_device(self.aafm.device_cwd))
AttributeError: Aafm_GUI instance has no attribute 'device_treeViewFile'

Second run:

EXECUTE ('adb', 'devices')
EXECUTE ('adb', '-s', '0032569052087e14', 'shell', 'cat', '/system/build.prop')
EXECUTE ('adb', '-s', '0032569052087e14', 'shell', 'ls', '--help')
EXECUTE ('adb', 'devices')
EXECUTE ('adb', '-s', '0032569052087e14', 'shell', 'cat', '/system/build.prop')
EXECUTE ('adb', '-s', '0064596052180e13', 'shell', 'ls', '-l', '-a', '/mnt/sdcard/')
EXECUTE ('adb', '-s', '0064596052180e13', 'shell', 'df', '/mnt/sdcard/')