Create raspberry pi device for backing up camera raw SD cards onto flash drives either in the field powered by battery or when plugged in
Just use USB SD card reader
- Make mirror of src to dest using rdiff-backup
How do we set params and/or configure the raspberry pi for certain tasks
Static config, have to have hooked up to monitor or ssh to change
Ideally could be turned on and off with a hardware button or BLE...
Setup a slick go webservice to be run on the raspberry pi for setting different params / options
Some examples of people doing this:
Use a hook/service kind of like retro-pie that would copy and merge config options from a file in a certain place on inserted USB media.
How does the raspberry pi know when to start copy over files from source to destination?
Have prescribed source, dest USB ports. Since all of these will be block devices, plug in device and find it in /dev
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 931.5G 0 disk
├─sda1 8:1 0 915.6G 0 part /
├─sda2 8:2 0 1K 0 part
└─sda5 8:5 0 15.9G 0 part [SWAP]
sdb 8:16 1 14.6G 0 disk
└─sdb1 8:17 1 14.6G 0 part /media/elijahc/CHERRY
sr0 11:0 1 1024M 0 rom
Then find it in /sys/class
$ tree /sys/class/block/
/sys/class/block/
├── sda -> ../../devices/pci0000:00/0000:00:01.0/0000:01:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/block/sda
├── sda1 -> ../../devices/pci0000:00/0000:00:01.0/0000:01:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/block/sda/sda1
├── sda2 -> ../../devices/pci0000:00/0000:00:01.0/0000:01:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/block/sda/sda2
├── sda5 -> ../../devices/pci0000:00/0000:00:01.0/0000:01:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/block/sda/sda5
├── sdb -> ../../devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3:1.0/host10/target10:0:0/10:0:0:0/block/sdb
├── sdb1 -> ../../devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3:1.0/host10/target10:0:0/10:0:0:0/block/sdb/sdb1
└── sr0 -> ../../devices/pci0000:00/0000:00:1f.2/ata1/host1/target1:0:0/1:0:0:0/block/sr0
Detect when SD card is inserted and when USB drive is inserted
- https://wiki.debian.org/udev
- https://www.tecmint.com/find-usb-device-name-in-linux/
- http://www.reactivated.net/writing_udev_rules.html#example-usbhdd
- https://stackoverflow.com/questions/589841/upstart-calling-script-for-inserted-usb-drive
- https://stackoverflow.com/questions/24574650/usb-device-detection-on-dev-directory-in-linux
- http://www.signal11.us/oss/udev/
- https://askubuntu.com/questions/25071/how-to-run-a-script-when-a-specific-flash-drive-is-mounted
- https://linuxconfig.org/tutorial-on-how-to-write-basic-udev-rules-in-linux
- https://pythonhosted.org/watchdog/
Use python or other listeners to detect when switches or buttons have been pressed https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/robot/buttons_and_switches/
Pro's
- Don't need power
https://www.amazon.com/slp/raspberry-pi-3-remote/xjww5q3ee4j9887 http://averagemaker.com/2015/05/7-remote-control-options-for-your.html
https://medium.com/@superlopuh/raspberry-pi-ios-communication-in-bluetooth-c7599e257f2
It would be convenient for the device to communicate to the user since it will be slow and we will often have to wait for things to be ready and/or done
Things useful to communicate to user:
- When is the pi ready?
- When has it started?
- When has it finished?
Seems most straightforward, can communicate configuration, status. Could also build this on top of simple defaults option
Todo:
- Flash clean SD with raspbian
- Experiment with creating udev rules
- Prototype rdiff-backup script