spion / adbfs-rootless

Mount Android phones on Linux with adb. No root required.
Other
890 stars 73 forks source link

Any way to avoid having to rescan SD card after using adbfs? #32

Open nicolas-raoul opened 6 years ago

nicolas-raoul commented 6 years ago

Steps to reproduce the problem:

  1. Mount Android using adbfs-rootless
  2. Take a screenshot on Android
  3. Remove it via adbfs: rm adbfs-root-directory/sdcard/Pictures/Screenshots/Screenshot_20180725-210642.png
  4. The file is not visible anymore via adbfs, ls adbfs-root-directory/sdcard/Pictures/Screenshots/ shows nothing
  5. Reboot the phone (optional)
  6. On Android, open the stock gallery app: The screenshot is still visible, however opening it only shows some grey
  7. Connect via MTP (ex: Nautilus): The screenshot is still visible, however opening it triggers libmtp error: Could not get file from device.
  8. Run https://github.com/jerickson314/sdscanner
  9. The file has disappeared from the stock gallery and Nautilus

While adb commands have had this kind of issues for a long time, is there any way adbfs could improve things, or do you have any tip to avoid such problems?

If not, how about having adbfs run a local rescan (only for the modified files)? If rescan is possible via ADB that would be the best, if not adbfs could call an optional companion app installed on the device that would perform the rescan.

ranolfi commented 4 years ago

There is, the program could issue adb shell "su -c 'am broadcast -a android.intent.action.MEDIA_MOUNTED -d file:///mnt/sdcard'" for example.