summaryrefslogtreecommitdiff
path: root/camlibs/sx330z/sx330z.h
blob: 0ecea7a29deb80d2afe271e87c45f94abcf7c768 (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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/* sx330z.h
 *
 * Copyright © 2002 Dominik Kuhlen <dkuhlen@fhm.edu>
 *
 * 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., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */
/*
 * GPhoto library for sx330z camera ....
 * first try 6/2002 by Dominik Kuhlen  <dkuhlen@fhm.edu>
 */


#include <gphoto2/gphoto2-camera.h>
#include <gphoto2/gphoto2-context.h>


/* USB spec violating ! */
#define USB_REQ_RESERVED 0x04

/* is this correct ? */
#define USB_VENDOR_TRAVELER	0x0d96

/* this one should work */
#define USB_PRODUCT_SX330Z	0x3300

/* very experimental !!! 
 * Please report if this works
 */
#define USB_PRODUCT_SX410Z	0x4100
/* same as MD6000 */
#define USB_PRODUCT_MD9700	0x4102

/* different requests (are there more ?) */
#define SX330Z_REQUEST_INIT	0x0001		/* not sure */
#define SX330Z_REQUEST_TOC_SIZE 0x0002
#define SX330Z_REQUEST_TOC	0x0003
#define SX330Z_REQUEST_IMAGE	0x0004
#define SX330Z_REQUEST_DELETE	0x0010

#define SX_THUMBNAIL 1
#define SX_IMAGE 0


/* 0x14 Bytes TOC entry */
struct traveler_toc_entry
{
 char 		name[12];	/* SIMGxxxx.jpg (not 0 terminated) */
 int32_t 	time;		/* ? */
 int32_t 	size;		/* in bytes (%4096 is 0)*/
};

/* 0x200 Bytes TOC Page */
struct traveler_toc_page
{
 int32_t data0;			/* don't know ? (0) */
 int32_t data1;			/* don't know ? (0) */
 int16_t always1;		/* 1 ? */
 int16_t numEntries;		/* number of entries in TOC page (0 .. 25)*/
 struct traveler_toc_entry entries[25]; /* entries */
};

struct _CameraPrivateLibrary 
{
 int usb_product;		/* different Thumbnail size */
};


/* 0x20 Bytes  Request	*/
struct traveler_req
{
 int16_t	always1;		/* 0x01 */
 int16_t	requesttype;		/* 0x0003 : TOC , 0x0004 Data */
 int32_t	data;			/* dontknow */
 int32_t	timestamp;		/* counter? only 24 bit  */
 int32_t 	offset;			/* fileoffset */
 int32_t 	size;			/* transfer bolcksize */
 char		filename[12];		/* SIMG????jpg for Real image */   					/* TIMG????jpg for Thumbnail */
};

/* 0x10 Bytes Acknowledge */
struct traveler_ack
{
 int32_t always3;	/* 3 */
 int32_t timestamp;	/* not sure */ 
 int32_t size;		/* for TOC and other transfers */
 int32_t dontknow;	/* always 0 */
};


/*
 *  There's not a real initialization,
 *  but ...
 */
int sx330z_init(Camera *camera,GPContext *context);


/*
 * Get number of TOC pages 
 */
int sx330z_get_toc_num_pages(Camera *camera,GPContext *context, int32_t *pages);


/*
 * Get TOC 
 */
int sx330z_get_toc_page(Camera *camera,GPContext *context,struct traveler_toc_page *toc,int page);

/*
 *  Load image data (thumbnail(exif) / image)
 */
int sx330z_get_data(Camera *camera,GPContext *context, const char* filename,
   		    char **,unsigned long int *size,int thumbnail);



/*
 *  Delete image 
 */
int sx330z_delete_file(Camera *camera,GPContext *context,const char *filename);

/*
 *  Exit camera
 */
int camera_exit(Camera *camera, GPContext *context);