jim-easterbrook / python-gphoto2

Python interface to libgphoto2
GNU Lesser General Public License v3.0
360 stars 59 forks source link

Can we format SD card present in dslr from desktop using libgphoto2 #88

Closed amolagrawal05 closed 4 years ago

amolagrawal05 commented 4 years ago

I am doing camera automation. Wanted to know whether can we format sd card present in dslr from desktop connected over usb cable. Also can we power on/power off the camera from desktop ?

jim-easterbrook commented 4 years ago

Formatting the SD card, if it's possible, will be camera dependent. Try the camera-config-gui.py example to see what things are possible on your camera.

Controlling the camera power would require some sort of computer controlled PSU for it. If you turn it off over USB it will not be listening to USB so you won't be able to turn it back on.

Questions like these are not about the Python interface but are more general gphoto2 questions. The gphoto2 mailing lists are a more suitable forum, with lots of gphoto2 users who may be able to help.

amolagrawal05 commented 4 years ago

Thank you so much for the quick reply. Sorry for posting in wrong forum will make sure to post in right forum going forward. if suppose formatting SD card is possible in some particular camera, can you explain how can we do it.

jim-easterbrook commented 4 years ago

If it's possible I would expect it to be done by setting a configuration option. Several of the example programs set configuration, e.g. set-camera-clock.py and time_lapse.py.

amolagrawal05 commented 4 years ago

When you say if it’s possible, will be camera dependent. Does this mean if at all possible then gphoto2 will support it. Just wanted to confirm that there is no case where formatting is possible and gphoto2 doesn’t support it or there can be a situation where gphoto2 doesn’t support it. Moreover i checked using gphoto2 -a (abilities) for nikon d3400 and formatting is not supported, is this same as what you have suggested camera-config-gui.py above ? If not, i will check camera-config-gui.py Sorry for bothering you so much.

jim-easterbrook commented 4 years ago

As far as I know gphoto2 has been developed by "reverse engineering" various cameras. If a camera could reformat but gphoto2 can't do it then someone needs to analyse USB traffic when reformatting the card to see how it's done, then add that ability to the gphoto2 camera driver.

The gphoto2 -a command should list the same options as shown in the camera-config-gui.py example.

amolagrawal05 commented 4 years ago

Thank you for your inputs. I checked we can manually format sd card from camera in nikon d3400. However gphoto2 -a does not show the same ability. This means gphoto2 lacks the feature of formatting and like you said somebody needs to add this feautre right ?

jim-easterbrook commented 4 years ago

Not quite, what matters is if the camera manufacturer's software can reformat the SD card remotely, i.e. send a USB command from the computer to the camera telling the camera to reformat its SD card.

amolagrawal05 commented 4 years ago

Ok makes sense. I have checked nikon sdk(available on their site) and couldn’t find SD card formatting.

amolagrawal05 commented 4 years ago

Hey i have mounted camera as filesystem on ubuntu using gphotofs. Is there a way i can format the camera sd card now ?

jim-easterbrook commented 4 years ago

I have no idea. This is the "issues" page for the Python interface to libgphoto2 and your question is way off topic.