If you want to hack on gphoto2 (or a camera driver for gphoto2), please follow some rules to make our work easier: licensing --------- We urge you to license your contributions under the LGPL so we can distribute gphoto2 under the LGPL as well. patches ------- ... are always welcome. Please have something like cvs -z4 -q diff -u3 -p update -dP checkout -P in $HOME/.cvsrc and send us the output of "cvs diff some_file.c". We prefer patches against the current CVS version very much over patches agains old released versions, but these are also welcome :-) camlib ------ Camera libraries are often very sensitive to changes. Therefore, before you commit any changes, double check with the author that your changes won't break the driver. If you want to write a driver for gphoto2, the easiest way to do so would be to copy over the contents of camlibs/template and fill in your code. Use something like CHECK_RESULT (see for example libgphoto2/filesys.c). Let's say you write a driver called sillycam. Please set up a file called library.c containing all gphoto2-specific code (like camera_init) and another two files called sillycam.c and sillycam.h containing the "magic", that is all gp_port_[read,write] functions and the basic logic of the communication. This makes it easier for us to adapt your code if anything should change in the gphoto2-API. Use the port provided by camera->port. Use the filesystem provided by camera->fs and set up the callbacks so that libgphoto2 can cache listings and file-information. Please keep track of the changes to the sillycam camlib in the file camlib/sillycam/ChangeLog libgphoto2 ---------- If you add code, use the coding style of that file. This is, code like int my_func (int arg) { int var, res; /* * This is a multiline * comment. Use TAB for * indentation! */ res = gp_some_action (var); /* This is a simple one-line comment */ if (res < 0) { gp_log (GP_LOG_DEBUG, "Error happened!"); /* Note that we _don't_ indent the case statements */ switch (res) { case GP_ERROR: gp_log (GP_LOG_DEBUG, "Generic error"); break; default: gp_log (GP_LOG_DEBUG, "Not a generic error"); } return (res); } return (GP_OK); } Please always check the return value of gp_-functions! We defined some handy macros all over the place (like CHECK_RESULT) - by using those, you'll avoid lots of if {} else {}. Emacs users may define and use a gphoto-c-mode by putting the following stuff into their .emacs file: -----8<------------------------------------------------ ;;* gphoto-c-mode ;;*===================================================================== (defun gphoto-c-mode () "C mode with adjusted defaults for gphoto hacking" (interactive) (c-mode) (c-set-style "linux") (setq indent-tabs-mode t) (font-lock-mode)) ;; (setq auto-mode-alist (cons '("/home/user/src/gphoto.*\\.[ch]$" . gphoto-c-mode) auto-mode-alist)) -----8<------------------------------------------------ Local Variables: mode:text End: