View Single Post
Old 03-12-2020, 06:36 PM   #3
OrangeFlavored
Enthusiast
OrangeFlavored doesn't litterOrangeFlavored doesn't litter
 
Posts: 34
Karma: 100
Join Date: Oct 2014
Device: Likebook Mars
Yeah for now just automated the backup process using Windows Task Scheduler, figured I'd share my process if anyone else is interested in doing so:

First open up Event Viewer and go to Applications and Services -> Microsoft -> Windows -> DriverFrameworks-UserMode and right click Operational, Enable Log. Then plug your device in, refresh the list, find a bunch of Verbose items that popped up, go to Details, copy down the InstanceId and paste it into this:

Code:
<QueryList>
  <Query Id="0" Path="Microsoft-Windows-DriverFrameworks-UserMode/Operational">
    <Select Path="Microsoft-Windows-DriverFrameworks-UserMode/Operational">*[System[Provider[@Name='Microsoft-Windows-DriverFrameworks-UserMode'] and (Level=5) and Task = 33 and (EventID=2004)]]
	and
	*[UserData[UMDFHostAddDeviceBegin[(InstanceId='PASTE_YOUR_INSTANCE_ID_HERE')]]]</Select>
  </Query>
</QueryList>
Also make sure to replace any & with &amp; since they'll screw up your filter. Then you go to Task Scheduler and make a new task with the trigger set to "Custom event filter" and click Custom, Edit Event Filter, XML, check "Edit query manually" and paste that in there. From here you can have your task do whatever is appropriate for your particular e-reader, in my case I couldn't figure a good way to copy files from a MTP device on the command prompt so I just enabled USB debugging and did it through the ADB like so:

Code:
adb shell mkdir /sdcard/Download/Temp
adb shell cp -r /sdcard/Books/*.sdr/ /sdcard/Download/Temp
adb pull /sdcard/Download/Temp G:\Backup\KOReader\%date:~-8,4%_%date:~-14,2%_%date:~-11,2%
adb shell rm -r /sdcard/Download/Temp
Saved that in a .bat file and set as target for the created task, and then saved it. Finally set it as hidden and "Run whether user is logged in or not" so that it won't pop up a command prompt window and runs silently in the background. Seems to be working out well so far, copies all those folders over silently each time the device is plugged in, so if something goes wrong should have a decent amount of backups. Pretty much serves the same purpose as what the old KoboUtilities plugin did so I am content for now. Actually KoboUtilities tended to take a pretty long time to fetch all that data when I plugged my device in so in that regard this is better, happening in the background and only taking a second or two.

If you can't or don't want to enable USB debugging but have some experience with Python I know there's a few libraries there such as PyMTP that allow you to copy files over from a MTP device, that might work out for you. Also if your device doesn't use MTP and just mounts on a normal drive letter then all that is irrelevant and you can just have your batch file copy the folders over as normal.

Last edited by OrangeFlavored; 03-12-2020 at 07:09 PM.
OrangeFlavored is offline   Reply With Quote