Help for a script - USB clone
Hi meamians,
I would like to start trying to create some scripts for Sailfish before a proper app (Btw, I downloaded the Sailfish SDK, but Windows 7 is not supported). My idea is to create a simple script doing this: 1. Checks if there is an usb stick device conected to the phone (maybe just checking if the folders in the usbstick folder are not all empty) 2. Copies the content of the usb stick to a new folder on the phone memory (or compress it to a zip) Could someone show me where can I find useful informations about the commands I need? |
Re: Help for a script - USB clone
sound like usb data stealer to me :)
do you want to steal right answers from your teacher's usb stick or you want to steal government plans? |
Re: Help for a script - USB clone
Ahah, yes it sounds something like this! But no, I just want to have a useful tool to copy all the photos on memory cards in a fast way. It would be very nice to implement a sort of functions to do the inverse process, creating a quick backup of photos videos etc. on a usb stick.
|
Re: Help for a script - USB clone
You would fill up Phone memory very fast by this.
|
Re: Help for a script - USB clone
It is not intended to be used several times in a row, but just somethink tthat would be useful to have on the phone if needed.
Anyway, I'm going to try and report back here. |
Re: Help for a script - USB clone
Well that would actually be very helpful to empty full SD card when out doing photography. I have no USB-OTG on my phone, but otherwise I would definitely use this on occasions.
|
Re: Help for a script - USB clone
Empty a full SD? How many pictures do you take? I have a 4 GB memory stick in mine that takes me about 6 months to fill to more than 50%.
|
Re: Help for a script - USB clone
Quote:
If you shoot 18Mpix RAWs thats 25MB a photo. 4GB / 25MB = 160 photos If you shoot a sunset where you bracket to do HDR, that means it fills even quicker. In the three years I stepped up my photography game, I shot about 14000 photos. That's around 350GB. I definitely could see the use of this. :) Maybe even as backup solution when travelling. |
Re: Help for a script - USB clone
Quote:
With udev rules you can match one specific drive (by manufacturer, model, size etc.), or write a loose rule that matches all usb sticks, for example. This is a great guide for writing rules: http://reactivated.net/writing_udev_rules.html The major downside for you of this approach is that adding new udev rules is a system level change that requires root, so it's not ideal for use with an app. Maybe someone else has ideas about how you can get around this. And just for fun, here is a rule I wrote to mount a known drive containing media files at a consistent mount point, so that it can be shared using NFS (on an ubuntu box running kodi): Code:
SUBSYSTEM=="block",ATTR{partition}=="1",ATTR{size}=="1953521664",ATTRS{model}=="MQ01ABD100",ATTRS{vendor}=="TOSHIBA",SYMLINK+="SLICE",RUN+="/bin/mount -o defaults,user,noexec /dev/SLICE /srv/nfs/SLICE" |
Re: Help for a script - USB clone
In SailfishOS' specific configuration, the mounting of sd cards is handled by the "sd-utils" RPM package.
- /lib/udev/rules.d/90-mount-sd.rules is the udev rule file that reacts to new block devices. - /lib/systemd/system/mount-sd@.service is the systemd service template that is called (WANTed) for each new block device - /usr/sbin/mount-sd.sh is the script started by the service, that is in charge of detecting and auto-mounting partitions. (That's the one I patched to get swapdevices). --- I would propose : - either go for a sysremd service, "Type= oneshot", using "WantedBy=" and "After=" parameters - or as proposed above : write you own udev rule, but pay attention to have it with a number higher than 90 (so its called after the mount). Quote:
--- *: If any one know a good brand of 256GB microSD cards that has static-wear-leveling, ECC, and can survive to swap ? |
All times are GMT. The time now is 12:40. |
vBulletin® Version 3.8.8