summaryrefslogtreecommitdiff
path: root/camlibs/sierra/sierra.h
blob: 539d187f50e5efd8259a9db168a0e325eb69d8f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/* sierra.c:
 *
 * Copyright 2001 Lutz Mueller <lutz@users.sourceforge.net>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA  02110-1301  USA
 */
typedef enum {
	SIERRA_MODEL_DEFAULT,
	SIERRA_MODEL_EPSON,
	SIERRA_MODEL_OLYMPUS,
	SIERRA_MODEL_CAM_DESC,
} SierraModel;

typedef enum {
	/* 2 bits USB wrap type ... none = 0 */
	SIERRA_WRAP_USB_NONE	= 0<<0,
	SIERRA_WRAP_USB_OLYMPUS	= 1<<0,
	SIERRA_WRAP_USB_NIKON	= 2<<0,
	SIERRA_WRAP_USB_PENTAX	= 3<<0,
	SIERRA_WRAP_USB_MASK	= 3<<0,

	SIERRA_NO_51	 	= 1<<2,
	SIERRA_LOW_SPEED	= 1<<3,	/* serial line 9600 -> 38400 */
	SIERRA_EXT_PROTO	= 1<<4,
	SIERRA_SKIP_INIT	= 1<<5,
	SIERRA_NO_USB_CLEAR	= 1<<6,
	SIERRA_NO_REGISTER_40	= 1<<7,
	SIERRA_MID_SPEED	= 1<<8,	/* serial line 9600 -> 57600 */
	SIERRA_NO_BLOCK_WRITE	= 1<<9,
} SierraFlags;

struct _CameraPrivateLibrary {
	SierraModel model;
	int folders;
	int speed;
	int first_packet;
	SierraFlags flags;
	struct CameraDesc const *cam_desc;
	char folder[128];
};

struct CameraDescriptor;

#define CHECK(result)					\
{							\
	int res = (result);				\
							\
	if (res < 0) {					\
		gp_log (GP_LOG_DEBUG, "sierra",		\
			"Operation failed in %s (%i)!", __FUNCTION__, res);	\
		return (res);				\
	}						\
}