| 1 |
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ |
| 2 |
/* vcamera.h |
| 3 |
* |
| 4 |
* Copyright (c) 2015,2016 Marcus Meissner <[email protected]> |
| 5 |
* |
| 6 |
* This library is free software; you can redistribute it and/or |
| 7 |
* modify it under the terms of the GNU Lesser General Public |
| 8 |
* License as published by the Free Software Foundation; either |
| 9 |
* version 2 of the License, or (at your option) any later version. |
| 10 |
* |
| 11 |
* This library is distributed in the hope that it will be useful, |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 |
* Lesser General Public License for more details. |
| 15 |
* |
| 16 |
* You should have received a copy of the GNU Lesser General Public |
| 17 |
* License along with this library; if not, write to the |
| 18 |
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 19 |
* Boston, MA 02110-1301 USA |
| 20 |
*/ |
| 21 |
|
| 22 |
#ifndef IOLIBS_VUSB_VCAMERA_H |
| 23 |
#define IOLIBS_VUSB_VCAMERA_H |
| 24 |
|
| 25 |
#undef FUZZING |
| 26 |
#define FUZZ_PTP |
| 27 |
|
| 28 |
#include <stdio.h> |
| 29 |
|
| 30 |
typedef struct ptpcontainer { |
| 31 |
unsigned int size; |
| 32 |
unsigned int type; |
| 33 |
unsigned int code; |
| 34 |
unsigned int seqnr; |
| 35 |
unsigned int nparams; |
| 36 |
unsigned int params[6]; |
| 37 |
} ptpcontainer; |
| 38 |
|
| 39 |
typedef enum vcameratype { |
| 40 |
GENERIC_PTP, |
| 41 |
NIKON_D750 |
| 42 |
} vcameratype; |
| 43 |
|
| 44 |
typedef struct vcamera { |
| 45 |
int (*init)(struct vcamera*); |
| 46 |
int (*exit)(struct vcamera*); |
| 47 |
int (*open)(struct vcamera*, const char*port); |
| 48 |
int (*close)(struct vcamera*); |
| 49 |
|
| 50 |
int (*read)(struct vcamera*, int ep, unsigned char *data, int bytes); |
| 51 |
int (*readint)(struct vcamera*, unsigned char *data, int bytes, int timeout); |
| 52 |
int (*write)(struct vcamera*, int ep, const unsigned char *data, int bytes); |
| 53 |
|
| 54 |
unsigned short vendor, product; /* for generic fuzzing */ |
| 55 |
|
| 56 |
vcameratype type; |
| 57 |
unsigned char *inbulk; |
| 58 |
int nrinbulk; |
| 59 |
unsigned char *outbulk; |
| 60 |
int nroutbulk; |
| 61 |
|
| 62 |
unsigned int seqnr; |
| 63 |
|
| 64 |
unsigned int session; |
| 65 |
ptpcontainer ptpcmd; |
| 66 |
|
| 67 |
int exposurebias; |
| 68 |
unsigned int shutterspeed; |
| 69 |
unsigned int fnumber; |
| 70 |
|
| 71 |
#ifdef FUZZING |
| 72 |
int fuzzmode; |
| 73 |
#define FUZZMODE_PROTOCOL 0 |
| 74 |
#define FUZZMODE_NORMAL 1 |
| 75 |
FILE* fuzzf; |
| 76 |
unsigned int fuzzpending; |
| 77 |
#endif /* FUZZING */ |
| 78 |
} vcamera; |
| 79 |
|
| 80 |
vcamera *vcamera_new(vcameratype); |
| 81 |
|
| 82 |
#endif /* !defined(IOLIBS_VUSB_VCAMERA_H) */ |