Testing libgphoto2/gphoto2 is a long winding task and currently requires physical cameras.

There is some testsuite, but it does not test the actual camera driver(s).

The idea was to write a virtual usb device in libgphoto2_port that emulates a PTP camera.

It should do regular behaviour, but it can also be improved to react on errors (like random unplug, bit errors, or even as a malicious device).

The virtual PTP camera can be found in https://github.com/gphoto/libgphoto2/tree/master/libgphoto2_port/vusb

It currently supports:

  • basic camera information
  • listing files (from a local directory)
  • downloading files (from a local directory)
  • downloading thumbnails (extracted using libexif)
  • deleting files (but only in the in-memory structure)
  • querying device properties (battery level and datetime implemented)
  • event handling via USB Interrupts
  • triggering capture and downloading captured images

Current state:

  • Has achieved "Conformant Device" state according to ISO 15740 ( http://people.ece.cornell.edu/land/courses/ece4760/FinalProjects/f2012/jmv87/site/files/pima15740-2000.pdf page 107) , allowing common download operations.
  • The virtual camera is already recognized and usable by gphoto2, digikam, darktable, gtkam, konqueror camera:// ioslave. (It is not visible by shotwell as it uses udev detection which would need a real USB device.)
  • Project is finished in scope of Hackweek 13.

Future development steps:

  • tethering (external driven events)
  • random unplug testing
  • data protocol fuzzing

Looking for hackers with the skills:

Nothing? Add some keywords!

This project is part of:

Hack Week 13

Activity

  • almost 9 years ago: msmeissn liked this project.
  • almost 9 years ago: msmeissn started this project.
  • almost 9 years ago: msmeissn originated this project.

  • Comments

    • msmeissn
      almost 9 years ago by msmeissn | Reply

      The virtual PTP camera can be found in https://github.com/gphoto/libgphoto2/tree/master/libgphoto2_port/vusb

      It currently supports:

      • basic camera information
      • listing files (from a local directory)
      • downloading files (from a local directory)
      • downloading thumbnails (extracted using libexif)
      • deleting files (but only in the in-memory structure)
      • querying device properties (battery level and datetime implemented)

      The camera is recognized by gphoto2, digikam, darktable, gtkam, konqueror camera:// ioslave. (not visible by shotwell as it uses udev detection)

      Next to do: - add capture support - add event handling

      Future ideas: - random unplug testing - data fuzzing

    Similar Projects

    This project is one of its kind!