#include <stdio.h>#include <string.h>#include <math.h>#include <sys/types.h>#include <linux/limits.h>#include <usb.h>#include <ctype.h>#include <time.h>#include <fcntl.h>#include <unistd.h>#include <sys/stat.h>#include "../config.h"#include <locale.h>#include <libintl.h>#include "hp215.h"Include dependency graph for hp215.c:

Go to the source code of this file.
Defines | |
| #define | _(String) gettext (String) |
Functions | |
| void | dprint (char *msg) |
| This function prints debug information. | |
| void | hex_dump (unsigned char *msg, int size, char *text) |
| This function prints a hexdump from data. | |
| int | hp_gen_cmd (int cmd, int num, unsigned char *buffer) |
| Generate a camera commando. | |
| int | hp_new_file (CamFile **file) |
| Space for a new file. | |
| int | hp_append_file (CamFile *file, const unsigned char *data, unsigned long int size) |
| Append filedata. | |
| int | hp_send_ack (t_camera *cam, int ep) |
| Sending ACK. | |
| int | hp_rcv_ack (t_camera *cam, int ep) |
| Reading a ACK. | |
| usb_device * | find_device (int vendorID, int productID) |
| Searches for the usb device. | |
| int | hp_open (t_camera *cam, int tryInitCamTwice) |
| Open the camera. | |
| int | hp_init_sequence (t_camera *cam) |
| Generate a init sequence. | |
| int | hp_get_timeDate_cam (t_camera *cam) |
| Get date and time. | |
| int | hp_get_photo_album (t_camera *cam) |
| Get the number of pictures. | |
| int | hp_get_previews (t_camera *cam, int picNumbers, int picNumber[MAX_PICS], char *subDir) |
| Get previews. | |
| int | hp_write_previews (t_camera *cam, int picNumbers, int picNumber[MAX_PICS]) |
| Write previews. | |
| int | hp_get_write_pics (t_camera *cam, int picNumbers, int picNumber[MAX_PICS], char *subDir) |
| Write picture. | |
| int | hp_delete_pics (t_camera *cam, int picAll, int picNumbers, int picNumber[MAX_PICS]) |
| Delete pictures. | |
| int | hp_delete_some_pics (t_camera *cam, int picNumbers, int picNumber[MAX_PICS]) |
| Delete pictures. | |
| int | hp_delete_all_pics (t_camera *cam) |
| Delete pictures. | |
| void | hp_create_html_page (t_camera *cam, int picNumbers, int picNumber[MAX_PICS], char *subDir, int prev, int pics, int subDirFull) |
| Write picture. | |
| void | read_ini (t_mode *mode) |
| Read the commandline. | |
| void | ini_delComment (char *buf) |
| Delete comments. | |
| void | ini_getNoElements (int *no, char *buf) |
| Get the number of elements on the string. | |
| void | init_modeValues (t_mode *mode) |
| Init mode values. | |
| void | read_cmd (int *argc, char ***argv, t_mode *mode) |
| Read the commandline. | |
| void | acceptOptions (t_mode *mode, int *argc, char **argv[], int callmode) |
| Read the commandline. | |
| void | gen_subDirName (char subdir[100]) |
| Generate sub dir name. | |
| void | gen_subDir (char subdir[100]) |
| Generate sub directory. | |
| int | hp_get_timeDate_pics (t_camera *cam, int picNumbers, int picNumber[MAX_PICS], char *subDir, char *dateStr, int subDirPrev, int subDirFull) |
| Get picture time/date. | |
| void | read_number (int *picNumbers, int picNumber[MAX_PICS], char *noStr) |
| Get picture time/date. | |
| void | getDateStr (char *inStr, unsigned int picSum, unsigned int picNo, t_date date, char *picStr, int mode) |
| Generate datetime string. | |
| void | test_dateString (char *dateStr) |
| Test datetime string. | |
| void | check_dateStr (char *dateStr) |
| Check the date string. | |
| void | test_cmd (t_mode mode) |
| Prints programm usage. | |
| void | checkPid (void) |
| Checks if the program is already running. | |
| void | removeLockFile (void) |
| Deletes the lock file. | |
| void | myExit (int value, int doRemoveLockFile) |
| void | usage (void) |
| Prints programm usage. | |
| void | add_dateInsidePicture (char *dateInPicStr, int picNumbers, int picNumber[MAX_PICS], t_camera *myCam) |
| Adds date/time string in the picture. | |
| int | main (int argc, char *argv[]) |
Variables | |
| char | monNameLong [12][30] |
| char | monNameShort [12][30] |
| int | DEBUG = 0 |
| int | TIMEOUT |
| int | DEBUG_HEXDUMP = 0 |
|
|
||||||||||||||||||||
|
Definition at line 2217 of file hp215.c. References _, t_mode::albm, t_mode::dateCam, t_mode::dateInPic, t_mode::dateInPicStr, t_mode::datePics, t_mode::dateStr, DEBUG, DEBUG_HEXDUMP, t_mode::delt, t_mode::forceDeletion, t_mode::html, t_mode::main, MAX_DS_STRLEN, myExit(), NORMAL_MODE, t_mode::picNumber, t_mode::picNumberRH, t_mode::picNumberRL, t_mode::picNumberRR, t_mode::picNumbers, t_mode::picNumbersRH, t_mode::picNumbersRL, t_mode::picNumbersRR, t_mode::pics, t_mode::prev, t_mode::printCmd_cmd, t_mode::printCmd_picNo, PRTCMD_MODE, read_number(), t_mode::subDirFull, t_mode::subDirPrev, TIMEOUT, t_mode::tmp_html, t_mode::tryInitCamTwice, TSTDAT_MODE, and usage(). Referenced by read_cmd(), and read_ini(). |
|
||||||||||||||||||||
|
Definition at line 4088 of file hp215.c. References _, DEBUG, getDateStr(), MAX_DS_STRLEN, MUST_NOT_USE_A_PICTURE_NUMBER, CamFile::name, and t_camera::pic. Referenced by main(). |
|
|
This function checks the values of the given date string by using the function "getDateStr". Definition at line 3676 of file hp215.c. References t_date::day, getDateStr(), t_date::hour, MAX_DS_STRLEN, t_date::min, t_date::month, MUST_NOT_USE_A_PICTURE_NUMBER, t_date::sec, and t_date::year. Referenced by main(). |
|
|
This function checks if the programm is already running. If yes it will abboard. If not it will continue. Definition at line 3739 of file hp215.c. References _, DEBUG, dprint(), and removeLockFile(). Referenced by main(). |
|
|
Definition at line 152 of file hp215.c. References DEBUG. Referenced by checkPid(), hp_delete_all_pics(), hp_delete_some_pics(), hp_get_photo_album(), hp_get_previews(), hp_get_timeDate_cam(), hp_get_timeDate_pics(), hp_get_write_pics(), hp_init_sequence(), hp_open(), hp_rcv_ack(), hp_send_ack(), and removeLockFile(). |
|
||||||||||||
|
Definition at line 548 of file hp215.c. References find_device(). Referenced by find_device(), and hp_open(). |
|
|
Definition at line 2740 of file hp215.c. Referenced by main(). |
|
|
Definition at line 2709 of file hp215.c. References monNameShort. Referenced by main(). |
|
||||||||||||||||||||||||||||
|
Hier is an overview of all codes:
|
|
||||||||||||||||
|
Definition at line 178 of file hp215.c. References _, and DEBUG_HEXDUMP. Referenced by hp_delete_some_pics(), hp_get_photo_album(), hp_get_previews(), hp_get_timeDate_cam(), hp_get_timeDate_pics(), and test_cmd(). |
|
||||||||||||||||
|
Definition at line 421 of file hp215.c. References _, CamFile::data, myExit(), CamFile::size, and SUCCESS. Referenced by hp_get_previews(). |
|
||||||||||||||||||||||||||||||||
|
Definition at line 1563 of file hp215.c. References _, monNameLong, myExit(), CamFile::name_nsd, t_camera::pic, and CamFile::preview_name_nsd. Referenced by main(). |
|
|
Definition at line 1483 of file hp215.c. References _, t_camera::dh, dprint(), FAIL, HP_CMD_DELETE_PICS, hp_get_photo_album(), hp_rcv_ack(), hp_send_ack(), t_camera::num_pics, SUCCESS, and TIMEOUT. Referenced by hp_delete_pics(). |
|
||||||||||||||||||||
|
Definition at line 1364 of file hp215.c. References hp_delete_all_pics(), hp_delete_some_pics(), and SUCCESS. Referenced by main(). |
|
||||||||||||||||
|
Definition at line 1396 of file hp215.c. References _, t_camera::dh, dprint(), FAIL, hex_dump(), hp_gen_cmd(), hp_get_photo_album(), hp_rcv_ack(), hp_send_ack(), t_camera::num_pics, SUCCESS, and TIMEOUT. Referenced by hp_delete_pics(). |
|
||||||||||||||||
|
Thanks to Roberto Ragusa for figuring out the algorithm for this. I would have never figured it out..
|
|
|
|
|
||||||||||||||||||||
|
Definition at line 1024 of file hp215.c. References _, DEBUG, t_camera::dh, dprint(), FAIL, hex_dump(), hp_append_file(), hp_gen_cmd(), hp_rcv_ack(), hp_send_ack(), t_camera::pic, SUCCESS, and TIMEOUT. Referenced by main(). |
|
|
Definition at line 811 of file hp215.c. References _, t_date::day, t_camera::dh, dprint(), FAIL, hex_dump(), t_date::hour, HP_CMD_DATETIME, hp_rcv_ack(), hp_send_ack(), t_date::min, monNameShort, t_date::month, SUCCESS, TIMEOUT, and t_date::year. Referenced by main(). |
|
||||||||||||||||||||||||||||||||
|
Definition at line 2783 of file hp215.c. References _, DEBUG, t_camera::dh, dprint(), FAIL, FULLSIZE_DIR, getDateStr(), hex_dump(), hp_gen_cmd(), hp_new_file(), hp_rcv_ack(), hp_send_ack(), MAX_DS_STRLEN, monNameShort, MUST_USE_A_PICTURE_NUMBER, t_camera::pic, PREVIEW_DIR, SUCCESS, and TIMEOUT. Referenced by main(). |
|
||||||||||||||||||||
|
Definition at line 1225 of file hp215.c. References _, CamFile::date_time, t_camera::dh, dprint(), FAIL, hp_gen_cmd(), hp_rcv_ack(), hp_send_ack(), myExit(), CamFile::name, t_camera::pic, SUCCESS, and TIMEOUT. Referenced by main(). |
|
|
|
|
|
Definition at line 386 of file hp215.c. References _, FAIL, and SUCCESS. Referenced by hp_get_timeDate_pics(). |
|
||||||||||||
|
Definition at line 589 of file hp215.c. References _, DEBUG, t_camera::device, t_camera::dh, dprint(), FAIL, find_device(), HP215_ID, HP_VENDOR_ID, and SUCCESS. Referenced by main(). |
|
||||||||||||
|
Definition at line 511 of file hp215.c. References _, ACK, t_camera::dh, dprint(), FAIL, SUCCESS, and TIMEOUT. Referenced by hp_delete_all_pics(), hp_delete_some_pics(), hp_get_photo_album(), hp_get_previews(), hp_get_timeDate_cam(), hp_get_timeDate_pics(), hp_get_write_pics(), and hp_init_sequence(). |
|
||||||||||||
|
Definition at line 475 of file hp215.c. References _, ACK, t_camera::dh, dprint(), FAIL, SUCCESS, and TIMEOUT. Referenced by hp_delete_all_pics(), hp_delete_some_pics(), hp_get_photo_album(), hp_get_previews(), hp_get_timeDate_cam(), hp_get_timeDate_pics(), hp_get_write_pics(), and hp_init_sequence(). |
|
||||||||||||||||
|
Definition at line 1167 of file hp215.c. References _, FAIL, t_camera::pic, and SUCCESS. Referenced by main(). |
|
|
Definition at line 1939 of file hp215.c. Referenced by read_ini(). |
|
||||||||||||
|
Definition at line 2001 of file hp215.c. Referenced by read_ini(). |
|
|
Definition at line 2062 of file hp215.c. References _, t_mode::albm, t_mode::dateCam, t_mode::dateInPic, t_mode::dateInPicStr, t_mode::datePics, t_mode::dateStr, t_mode::delt, t_mode::forceDeletion, t_mode::html, t_mode::main, monNameLong, monNameShort, t_mode::picNumberRH, t_mode::picNumberRL, t_mode::picNumberRR, t_mode::picNumbers, t_mode::picNumbersAll, t_mode::picNumbersRH, t_mode::picNumbersRL, t_mode::picNumbersRR, t_mode::pics, t_mode::prev, t_mode::subDirFull, t_mode::subDirPrev, TIMEOUT, t_mode::tmp_html, and t_mode::tryInitCamTwice. Referenced by main(). |
|
||||||||||||
|
||||||||||||
|
Definition at line 3870 of file hp215.c. References removeLockFile(). Referenced by acceptOptions(), gen_subDir(), getDateStr(), hp_append_file(), hp_create_html_page(), hp_get_write_pics(), hp_init_sequence(), main(), read_cmd(), read_ini(), and read_number(). |
|
||||||||||||||||
|
Definition at line 2164 of file hp215.c. References _, acceptOptions(), t_mode::html, t_mode::main, myExit(), t_mode::tmp_html, and usage(). Referenced by main(). |
|
|
Definition at line 1755 of file hp215.c. References _, acceptOptions(), ini_delComment(), ini_getNoElements(), and myExit(). Referenced by main(). |
|
||||||||||||||||
|
|
|
|
This function deletes the lock file. Definition at line 3822 of file hp215.c. Referenced by checkPid(), main(), and myExit(). |
|
|
Definition at line 3709 of file hp215.c. References _, DEBUG_HEXDUMP, hex_dump(), hp_gen_cmd(), t_mode::printCmd_cmd, t_mode::printCmd_picNo, and SUCCESS. Referenced by main(). |
|
|
Definition at line 3621 of file hp215.c. References _, t_date::day, getDateStr(), t_date::hour, MAX_DS_STRLEN, t_date::min, t_date::month, MUST_NOT_USE_A_PICTURE_NUMBER, t_date::sec, and t_date::year. Referenced by main(). |
|
|
This function prints the usage of this programm. Definition at line 3896 of file hp215.c. References _. Referenced by acceptOptions(), and read_cmd(). |
|
|
Definition at line 133 of file hp215.c. Referenced by acceptOptions(), add_dateInsidePicture(), checkPid(), dprint(), hp_get_previews(), hp_get_timeDate_pics(), hp_open(), main(), and read_number(). |
|
|
Definition at line 135 of file hp215.c. Referenced by acceptOptions(), hex_dump(), and test_cmd(). |
|
|
Definition at line 129 of file hp215.c. Referenced by getDateStr(), hp_create_html_page(), and init_modeValues(). |
|
|
Definition at line 130 of file hp215.c. Referenced by gen_subDirName(), getDateStr(), hp_get_timeDate_cam(), hp_get_timeDate_pics(), and init_modeValues(). |
|
|
Definition at line 134 of file hp215.c. Referenced by acceptOptions(), hp_delete_all_pics(), hp_delete_some_pics(), hp_get_photo_album(), hp_get_previews(), hp_get_timeDate_cam(), hp_get_timeDate_pics(), hp_get_write_pics(), hp_init_sequence(), hp_rcv_ack(), hp_send_ack(), and init_modeValues(). |
1.3.2