Significant restructuring: there are now only 5 types of camera, so we

should be able to add new cameras without modifying canon.h.
Cleaned up a few type warnings in log message calls.


git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@7385 67ed7778-7388-44ab-90cf-0a291f65f57c
This commit is contained in:
Stephen H. Westin
2004-11-17 20:28:35 +00:00
parent 5e104d449b
commit 2d945cefba
5 changed files with 266 additions and 417 deletions

View File

@@ -98,107 +98,111 @@
const struct canonCamModelData models[] = {
/* *INDENT-OFF* */
{"Canon:PowerShot A5", CANON_PS_A5, NO_USB, NO_USB, CAP_NON, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, "DE300 Canon Inc."},
{"Canon:PowerShot A5 Zoom", CANON_PS_A5_ZOOM, NO_USB, NO_USB, CAP_NON, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, "Canon PowerShot A5 Zoom"},
{"Canon:PowerShot A50", CANON_PS_A50, NO_USB, NO_USB, CAP_NON, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, "Canon PowerShot A50"},
{"Canon:PowerShot Pro70", CANON_PS_PRO70, NO_USB, NO_USB, CAP_NON, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, "Canon PowerShot Pro70"},
{"Canon:PowerShot S10", CANON_PS_S10, 0x04A9, 0x3041, CAP_NON, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, "Canon PowerShot S10"},
{"Canon:PowerShot A5", CANON_CLASS_3, NO_USB, NO_USB, CAP_NON, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, "DE300 Canon Inc."},
{"Canon:PowerShot A5 Zoom", CANON_CLASS_3, NO_USB, NO_USB, CAP_NON, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, "Canon PowerShot A5 Zoom"},
{"Canon:PowerShot A50", CANON_CLASS_1, NO_USB, NO_USB, CAP_NON, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, "Canon PowerShot A50"},
{"Canon:PowerShot Pro70", CANON_CLASS_2, NO_USB, NO_USB, CAP_NON, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, "Canon PowerShot Pro70"},
{"Canon:PowerShot S10", CANON_CLASS_0, 0x04A9, 0x3041, CAP_NON, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, "Canon PowerShot S10"},
{"Canon:PowerShot S20", CANON_PS_S20, 0x04A9, 0x3043, CAP_NON, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, "Canon PowerShot S20"},
{"Canon:EOS D30", CANON_EOS_D30, 0x04A9, 0x3044, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot S100", CANON_PS_S100, 0x04A9, 0x3045, CAP_NON, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
{"Canon:IXY DIGITAL", CANON_PS_S100, 0x04A9, 0x3046, CAP_NON, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
{"Canon:Digital IXUS", CANON_PS_S100, 0x04A9, 0x3047, CAP_NON, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot G1", CANON_PS_G1, 0x04A9, 0x3048, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, "Canon PowerShot G1"},
{"Canon:PowerShot Pro90 IS", CANON_PS_PRO90_IS, 0x04A9, 0x3049, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, "Canon PowerShot Pro90 IS"},
{"Canon:PowerShot S20", CANON_CLASS_0, 0x04A9, 0x3043, CAP_NON, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, "Canon PowerShot S20"},
{"Canon:EOS D30", CANON_CLASS_4, 0x04A9, 0x3044, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot S100", CANON_CLASS_0, 0x04A9, 0x3045, CAP_NON, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
{"Canon:IXY DIGITAL", CANON_CLASS_0, 0x04A9, 0x3046, CAP_NON, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
{"Canon:Digital IXUS", CANON_CLASS_0, 0x04A9, 0x3047, CAP_NON, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot G1", CANON_CLASS_0, 0x04A9, 0x3048, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, "Canon PowerShot G1"},
{"Canon:PowerShot Pro90 IS", CANON_CLASS_0, 0x04A9, 0x3049, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, "Canon PowerShot Pro90 IS"},
{"Canon:IXY DIGITAL 300", CANON_PS_S300, 0x04A9, 0x304B, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot S300", CANON_PS_S300, 0x04A9, 0x304C, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
{"Canon:Digital IXUS 300", CANON_PS_S300, 0x04A9, 0x304D, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot A20", CANON_PS_A20, 0x04A9, 0x304E, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot A10", CANON_PS_A10, 0x04A9, 0x304F, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
{"Canon:IXY DIGITAL 300", CANON_CLASS_1, 0x04A9, 0x304B, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot S300", CANON_CLASS_1, 0x04A9, 0x304C, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
{"Canon:Digital IXUS 300", CANON_CLASS_1, 0x04A9, 0x304D, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot A20", CANON_CLASS_1, 0x04A9, 0x304E, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot A10", CANON_CLASS_1, 0x04A9, 0x304F, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
/* Mac OS includes this as a valid ID; don't know which camera model --swestin */
{"Canon:PowerShot unknown 1", CANON_PS_UNK1, 0x04A9, 0x3050, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot unknown 1", CANON_CLASS_1, 0x04A9, 0x3050, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
/* Canon IXY DIGITAL 200 here? */
{"Canon:PowerShot S110", CANON_PS_S100, 0x04A9, 0x3051, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
{"Canon:DIGITAL IXUS v", CANON_PS_S100, 0x04A9, 0x3052, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot S110", CANON_CLASS_0, 0x04A9, 0x3051, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
{"Canon:DIGITAL IXUS v", CANON_CLASS_0, 0x04A9, 0x3052, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot G2", CANON_PS_G2, 0x04A9, 0x3055, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot S40", CANON_PS_S40, 0x04A9, 0x3056, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot S30", CANON_PS_S30, 0x04A9, 0x3057, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot A40", CANON_PS_A40, 0x04A9, 0x3058, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot A30", CANON_PS_A30, 0x04A9, 0x3059, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot G2", CANON_CLASS_1, 0x04A9, 0x3055, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot S40", CANON_CLASS_1, 0x04A9, 0x3056, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot S30", CANON_CLASS_1, 0x04A9, 0x3057, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot A40", CANON_CLASS_1, 0x04A9, 0x3058, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot A30", CANON_CLASS_1, 0x04A9, 0x3059, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
/* 305c is in MacOS Info.plist, but I don't know what it is --swestin. */
{"Canon:PowerShot unknown 2", CANON_PS_UNK2, 0x04A9, 0x305c, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot unknown 2", CANON_CLASS_1, 0x04A9, 0x305c, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
{"Canon:EOS D60", CANON_EOS_D60, 0x04A9, 0x3060, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot A100", CANON_PS_A100, 0x04A9, 0x3061, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot A200", CANON_PS_A200, 0x04A9, 0x3062, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
{"Canon:EOS D60", CANON_CLASS_4, 0x04A9, 0x3060, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot A100", CANON_CLASS_1, 0x04A9, 0x3061, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot A200", CANON_CLASS_1, 0x04A9, 0x3062, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot S200", CANON_PS_S200, 0x04A9, 0x3065, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
{"Canon:Digital IXUS v2", CANON_PS_S200, 0x04A9, 0x3065, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
{"Canon:Digital IXUS 330", CANON_PS_S330, 0x04A9, 0x3066, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot S200", CANON_CLASS_1, 0x04A9, 0x3065, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
{"Canon:Digital IXUS v2", CANON_CLASS_1, 0x04A9, 0x3065, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
{"Canon:Digital IXUS 330", CANON_CLASS_1, 0x04A9, 0x3066, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
/* 306a is in MacOS Info.plist, but I don't know what it is --swestin. */
{"Canon:Digital unknown 3", CANON_PS_UNK3, 0x04A9, 0x306a, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
/* Canon MVX2i in some mode is 0x3067 - probably PTP */
{"Canon:MVX2i", CANON_OPT_200, 0x04A9, 0x306B, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
{"Canon:Optura 200 MC", CANON_OPT_200, 0x04A9, 0x306B, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot S45 (normal mode)", CANON_PS_S45, 0x04A9, 0x306C, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
{"Canon:Digital unknown 3", CANON_CLASS_1, 0x04A9, 0x306a, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
/* Apparently the MVX2i is the same as Optura 200 MC (Philippe
* Gramoulle), so share the code. */
{"Canon:MVX2i", CANON_CLASS_1, 0x04A9, 0x306B, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
{"Canon:Optura 200 MC", CANON_CLASS_1, 0x04A9, 0x306B, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot S45 (normal mode)", CANON_CLASS_5, 0x04A9, 0x306C, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
/* 0x306D is S45 in PTP mode */
{"Canon:PowerShot G3 (normal mode)", CANON_PS_G3, 0x04A9, 0x306E, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot G3 (normal mode)", CANON_CLASS_5, 0x04A9, 0x306E, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
/* 0x306F is G3 in PTP mode */
{"Canon:PowerShot S230 (normal mode)", CANON_PS_S230, 0x04A9, 0x3070, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
{"Canon:Digital IXUS v3 (normal mode)", CANON_PS_S230, 0x04A9, 0x3070, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot S230 (normal mode)", CANON_CLASS_4, 0x04A9, 0x3070, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
{"Canon:Digital IXUS v3 (normal mode)", CANON_CLASS_4, 0x04A9, 0x3070, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
/* 0x3071 is S230/IXUS v3 in PTP mode */
{"Canon:PowerShot SD100 (normal mode)", CANON_PS_SD100, 0x04A9, 0x3072, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
{"Canon:Digital IXUS II (normal mode)", CANON_PS_SD100, 0x04A9, 0x3072, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot SD100 (normal mode)", CANON_CLASS_5, 0x04A9, 0x3072, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
{"Canon:Digital IXUS II (normal mode)", CANON_CLASS_5, 0x04A9, 0x3072, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
/* added from report on mailinglist. XXX: assuming capture works -Marcus */
/* PS A70 uses the same ProductID for PTP and Canon, with protocol autodetection */
{"Canon:PowerShot A70", CANON_PS_A70, 0x04A9, 0x3073, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot A70", CANON_CLASS_5, 0x04A9, 0x3073, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
/* PS A60 uses the same ProductID for PTP and Canon, with protocol autodetection */
{"Canon:PowerShot A60", CANON_PS_A60, 0x04A9, 0x3074, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot A60", CANON_CLASS_5, 0x04A9, 0x3074, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
/* reported working on SourceForge patch tracker. */
{"Canon:Digital IXUS 400", CANON_PS_S400, 0x04A9, 0x3075, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
/* PS S400 used the same ProductID for PTP and Canon, with protocol autodetection */
{"Canon:PowerShot S400", CANON_PS_S400, 0x04A9, 0x3075, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
/* PS S400 uses the same ProductID for PTP and Canon, with protocol autodetection */
{"Canon:Digital IXUS 400", CANON_CLASS_4, 0x04A9, 0x3075, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot S400", CANON_CLASS_4, 0x04A9, 0x3075, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot A300", CANON_PS_A300, 0x04A9, 0x3076, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot S50 (normal mode)", CANON_PS_S50, 0x04A9, 0x3077, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot A300", CANON_CLASS_4, 0x04A9, 0x3076, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot S50 (normal mode)", CANON_CLASS_4, 0x04A9, 0x3077, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
{"Canon:ZR70MC", CANON_CLASS_5, 0x04A9, 0x3078, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
{"Canon:ZR70MC", CANON_ZR70MC, 0x04A9, 0x3078, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
/* 3078 and 307a are in MacOS Info.plist, but I don't know
* what they are --swestin. */
{"Canon:PowerShot unknown 5", CANON_PS_UNK5, 0x04A9, 0x307a, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
/* 307a is in MacOS Info.plist, but I don't know what it is
* --swestin. */
{"Canon:PowerShot unknown 5", CANON_CLASS_5, 0x04A9, 0x307a, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
/* MV630i is a DV camcorder */
{"Canon:MV630i", CANON_MV630I, 0x04A9, 0x307b, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
{"Canon:MV650i", CANON_MV650I, 0x04A9, 0x3079, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
{"Canon:Optura 20", CANON_OPT_20, 0x04A9, 0x307f, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
{"Canon:Optura 10", CANON_OPT_10, 0x04A9, 0x3081, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
{"Canon:MV630i", CANON_CLASS_5, 0x04A9, 0x307b, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
{"Canon:MV650i", CANON_CLASS_5, 0x04A9, 0x3079, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
{"Canon:Optura 20", CANON_CLASS_5, 0x04A9, 0x307f, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
{"Canon:Optura 10", CANON_CLASS_5, 0x04A9, 0x3081, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
{"Canon:EOS 10D", CANON_CLASS_4, 0x04A9, 0x3083, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
{"Canon:EOS 300D (normal mode)", CANON_CLASS_4, 0x04A9, 0x3084, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
{"Canon:EOS Digital Rebel (normal mode)",CANON_CLASS_4, 0x04A9, 0x3084, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
{"Canon:EOS Kiss Digital (normal mode)",CANON_CLASS_4, 0x04A9, 0x3084, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
{"Canon:EOS 10D", CANON_EOS_10D, 0x04A9, 0x3083, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
/* 0x3099 is the EOS 300D/Digital Rebel in PTP mode */
{"Canon:EOS 300D (normal mode)", CANON_EOS_300D, 0x04A9, 0x3084, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
{"Canon:EOS Digital Rebel (normal mode)",CANON_EOS_300D,0x04A9, 0x3084, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
{"Canon:EOS Kiss Digital (normal mode)",CANON_EOS_300D, 0x04A9, 0x3084, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
/* PS G5 uses the same ProductID for PTP and Canon, with protocol autodetection */
{"Canon:PowerShot G5 (normal mode)", CANON_PS_G5, 0x04A9, 0x3085, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot G5 (normal mode)", CANON_CLASS_5, 0x04A9, 0x3085, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
/* Canon MVX3i / Optura Xi uses 308d in PTP mode; 3089 in Canon mode? */
{"Canon:PowerShot A80 (normal mode)",CANON_PS_A80, 0x04A9, 0x309A, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot S60 (normal mode)", CANON_PS_S60, 0x04A9, 0x30b2, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
{"Canon:Digital IXUS 500 (normal mode)",CANON_PS_S500, 0x04A9, 0x30b4, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot A75", CANON_PS_A75, 0x04A9, 0x30b5, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot A400", CANON_PS_A400, 0x04A9, 0x30b7, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot A310", CANON_PS_A310, 0x04A9, 0x30b8, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot A85 (normal mode)",CANON_PS_A85, 0x04A9, 0x30b9, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot S410 (normal mode)",CANON_PS_S410, 0x04A9, 0x30ba, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
{"Canon:Digital IXUS 430 (normal mode)",CANON_PS_S410, 0x04A9, 0x30ba, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot A95 (normal mode)",CANON_PS_A95, 0x04A9, 0x30bb, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot SD20 (normal mode)",CANON_PS_SD20, 0x04A9, 0x30c4, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
{"Canon:EOS 20D (normal mode)",CANON_EOS_20D, 0x04A9, 0x30eb, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
/* 0x3099 is the EOS 300D/Digital Rebel in PTP mode */
{"Canon:PowerShot A80 (normal mode)", CANON_CLASS_1, 0x04A9, 0x309A, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot S60 (normal mode)", CANON_CLASS_5, 0x04A9, 0x30b2, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
{"Canon:Digital IXUS 500 (normal mode)",CANON_CLASS_5, 0x04A9, 0x30b4, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot A75", CANON_CLASS_5, 0x04A9, 0x30b5, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot A400", CANON_CLASS_5, 0x04A9, 0x30b7, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot A310", CANON_CLASS_5, 0x04A9, 0x30b8, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot A85 (normal mode)", CANON_CLASS_5, 0x04A9, 0x30b9, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot S410 (normal mode)", CANON_CLASS_5, 0x04A9, 0x30ba, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
{"Canon:Digital IXUS 430 (normal mode)",CANON_CLASS_5, 0x04A9, 0x30ba, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot A95 (normal mode)", CANON_CLASS_5, 0x04A9, 0x30bb, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
{"Canon:PowerShot SD20 (normal mode)",CANON_CLASS_5, 0x04A9, 0x30c4, CAP_SUP, SL_MOVIE_SMALL, SL_THUMB, SL_PICTURE, NULL},
{"Canon:EOS 20D (normal mode)", CANON_CLASS_4, 0x04A9, 0x30eb, CAP_SUP, SL_MOVIE_LARGE, SL_THUMB, SL_PICTURE, NULL},
{NULL}
/* *INDENT-ON* */
@@ -322,27 +326,8 @@ canon_int_filename2audioname (Camera *camera, const char *filename)
{
char *result;
/* FIXME: I want capabilities */
/* FIXME: Do we really have to check the model here? Someone
* could just have inserted the CF card into another camera...
* */
switch (camera->pl->md->model) {
case CANON_PS_S30:
case CANON_PS_S40:
case CANON_PS_S45:
case CANON_PS_S50:
case CANON_PS_S400:
case CANON_PS_G3:
case CANON_PS_G5:
break;
default:
GP_DEBUG ("canon_int_filename2audioname: camera model doesn't support audio files");
return NULL;
break;
}
/* We use the audio file itself as the audio file of the
* audio file file. In short: audiofile = audiofile(audiofile)
/* We use the audio file itself as the audio file. In short:
* audiofile = audiofile(audiofile)
*/
if (is_audio (filename)) {
GP_DEBUG ("canon_int_filename2audioname: \"%s\" IS an audio file",
@@ -1114,8 +1099,8 @@ canon_int_capture_image (Camera *camera, CameraFilePath *path,
/**
* canon_int_set_file_attributes:
* @camera: camera to work with
* @dir: directory to work in
* @file: file to work on
* @dir: directory to work in
* @attrs: #canonDirentAttributeBits with the bits to set
* @context: context for error reporting
*

View File

@@ -62,126 +62,33 @@ typedef enum {
} canonJpegMarkerCode;
/**
* canonCamModel
* @CANON_PS_A5: PowerShot A5
* @CANON_PS_A5_ZOOM: PowerShot A5 Zoom
* @CANON_PS_A50: PowerShot A50
* @CANON_PS_A60: PowerShot A60
* @CANON_PS_A70: PowerShot A70
* @CANON_PS_A75: PowerShot A75
* @CANON_PS_A85: PowerShot A95
* @CANON_PS_A80: PowerShot A80
* @CANON_PS_A95: PowerShot A95
* @CANON_PS_PRO70: PowerShot Pro70
* @CANON_PS_S10: PowerShot S10
* @CANON_PS_S20: PowerShot S20
* @CANON_EOS_D30: EOS D30
* @CANON_PS_S100: PowerShot S100, PowerShot S110, IXY DIGITAL,
* Digital IXUS, DIGITAL IXUS v
* @CANON_PS_G1: PowerShot G1
* @CANON_PS_PRO90_IS: PowerShot Pro90 IS
* @CANON_PS_S300: PowerShot S300, Digital IXUS 300
* @CANON_PS_A20: PowerShot A20
* @CANON_PS_A10: PowerShot A10
* @CANON_PS_G2: PowerShot G2
* @CANON_PS_S40: PowerShot S40
* @CANON_PS_S30: PowerShot S30
* @CANON_PS_A40: PowerShot A40
* @CANON_PS_A30: PowerShot A30
* @CANON_EOS_D60: EOS D60
* @CANON_PS_A100: PowerShot A100
* @CANON_PS_A200: PowerShot A200
* @CANON_PS_A300: PowerShot A300
* @CANON_PS_S200: PowerShot S200, Digital IXUS v2
* @CANON_PS_S330: Digital IXUS 330
* @CANON_PS_S410: Digital IXUS 430
* @CANON_PS_S500: Digital IXUS 500
* @CANON_PS_S45: PowerShot S45
* @CANON_PS_S60: PowerShot S60
* @CANON_PS_G3: PowerShot G3
* @CANON_PS_G5: PowerShot G5
* @CANON_PS_S230: PowerShot S230, Digital IXUS v3
* @CANON_MV630I: MV630i camcorder
* @CANON_MV650I: MV650i camcorder
* @CANON_EOS_10D: EOS 10D
* @CANON_OPT_10: Optura 10
* @CANON_OPT_20: Optura 20
* @CANON_OPT_200: Optura 200 MC, MVX2i
* @CANON_PS_UNK1: Unknown camera seen in Mac OS X Image Capture
* @CANON_PS_UNK2: Unknown camera seen in Mac OS X Image Capture
* @CANON_PS_UNK3: Unknown camera seen in Mac OS X Image Capture
* @CANON_ZR70MC: Canon ZR70MC Mini-DV Camcorder
* @CANON_PS_UNK5: Unknown camera seen in Mac OS X Image Capture
* @CANON_EOS_300D: EOS 300D / Digital Rebel / KISS Rebel
* @CANON_PS_S50: PowerShot S50
* @CANON_PS_S400: PowerShot S400, Digital IXUS 400
* @CANON_PS_SD100: PowerShot SD100, Digital IXUS II
* @CANON_PS_A400: PowerShot A400
* @CANON_EOS_20D: EOS 20D
* canonCamClass:
* @CANON_CLASS_0: does not support key lock at all. Examples: G1,
* Pro 90is, S100, S10, S20
* @CANON_CLASS_1: supports lock, but not unlock. Supports (and
* requires) "get picture abilities" before capture.
* Examples: A5, A5 Zoom, A50, S30, S40, S200, S300,
* S330, G2, A10, A20, A30, A40, A100, A200,
* Optura200/MVX2i.
* @CANON_CLASS_2: like class 1, but doesn't support EXIF. Example: Pro 70.
* @CANON_CLASS_3: like class 1, but can't delete image
* @CANON_CLASS_4: supports lock/unlock. EOS D30 was first example; others
* include D60, 10D, 300D, S230, S400.
* @CANON_CLASS_5: supports lock, no unlock, but not "get picture abilities".
* Examples: S45, G3.
*
* Enumeration of all camera types currently supported.
* Enumeration of all camera types currently supported. Simplified so
* that all cameras with similar behavior have the same code.
*
*/
typedef enum {
CANON_PS_A5,
CANON_PS_A5_ZOOM,
CANON_PS_A50,
CANON_PS_A60,
CANON_PS_A70,
CANON_PS_A75,
CANON_PS_A80,
CANON_PS_A85,
CANON_PS_A95,
CANON_PS_S10,
CANON_PS_S20,
CANON_PS_S30,
CANON_PS_S40,
CANON_PS_PRO70,
CANON_PS_S100,
CANON_PS_S300,
CANON_PS_G1,
CANON_PS_G2,
CANON_PS_A10,
CANON_PS_A20,
CANON_PS_A30,
CANON_PS_A40,
CANON_EOS_D30,
CANON_PS_PRO90_IS,
CANON_PS_S330,
CANON_PS_S200,
CANON_PS_SD20,
CANON_EOS_D60,
CANON_PS_A100,
CANON_PS_A200,
CANON_PS_A300,
CANON_PS_A310,
CANON_PS_A400,
CANON_PS_S50,
CANON_PS_S45,
CANON_PS_G3,
CANON_PS_S230,
CANON_MV630I,
CANON_MV650I,
CANON_EOS_10D,
CANON_EOS_20D,
CANON_OPT_200,
/* In Mac OS Image Capture, but not yet seen in the wild. */
CANON_PS_UNK1,
CANON_PS_UNK2,
CANON_PS_UNK3,
CANON_ZR70MC,
CANON_PS_UNK5,
/* other cameras */
CANON_PS_S400,
CANON_PS_S410,
CANON_PS_S60,
CANON_PS_S500,
CANON_PS_SD100,
CANON_EOS_300D,
CANON_PS_G5,
CANON_OPT_20,
CANON_OPT_10
} canonCamModel;
CANON_CLASS_0,
CANON_CLASS_1,
CANON_CLASS_2,
CANON_CLASS_3,
CANON_CLASS_4,
CANON_CLASS_5
} canonCamClass;
/**
* canonTransferMode:
@@ -272,7 +179,7 @@ typedef enum {
struct canonCamModelData
{
char *id_str;
canonCamModel model;
canonCamClass model;
unsigned short usb_vendor;
unsigned short usb_product;
canonCaptureSupport usb_capture_support;
@@ -474,12 +381,7 @@ typedef enum {
* Treat PS 230 as EOS just as a guess; I really don't know.
*
*/
#define IS_EOS(cam) ( ((cam)==CANON_EOS_D30) \
|| ((cam)==CANON_EOS_D60) \
|| ((cam)==CANON_PS_S230) \
|| ((cam)==CANON_PS_S400) \
|| ((cam)==CANON_EOS_20D) \
)
#define IS_EOS(cam) ((cam)==CANON_CLASS_4)
/*
* All functions returning a pointer have malloc'ed the data. The caller must

View File

@@ -568,7 +568,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
* GP_FILE_TYPE_EXIF instead
*/
if (is_jpeg (filename)) {
if (camera->pl->md->model != CANON_PS_PRO70) {
if (camera->pl->md->model != CANON_CLASS_2) {
GP_DEBUG ("get_file_func: preview requested where "
"EXIF should be possible");
return (GP_ERROR_NOT_SUPPORTED);
@@ -589,7 +589,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
case GP_FILE_TYPE_EXIF:
#ifdef HAVE_EXIF
/* the PowerShot Pro 70 does not support EXIF */
if (camera->pl->md->model == CANON_PS_PRO70)
if (camera->pl->md->model == CANON_CLASS_2)
return (GP_ERROR_NOT_SUPPORTED);
thumbname = canon_int_filename2thumbname (camera, canon_path);
@@ -795,7 +795,7 @@ camera_summary (Camera *camera, CameraText *summary, GPContext *context)
tm = localtime (&tmp_time);
#ifdef HAVE_TM_GMTOFF
local_time = tmp_time + tm->tm_gmtoff;
GP_DEBUG ("camera_summary: converted %ld to localtime %ld (tm_gmtoff is %ld)",
GP_DEBUG ("camera_summary: converted %ld to localtime %ld (tm_gmtoff is %ld)",
(long)tmp_time, (long)local_time, (long)tm->tm_gmtoff);
#else
local_time = tmp_time - timezone;
@@ -866,7 +866,7 @@ delete_file_func (CameraFilesystem *fs, const char *folder, const char *filename
if (check_readiness (camera, context) != 1)
return GP_ERROR;
if (camera->pl->md->model == CANON_PS_A5 || camera->pl->md->model == CANON_PS_A5_ZOOM) {
if (camera->pl->md->model == CANON_CLASS_3) {
GP_DEBUG ("delete_file_func: deleting "
"pictures disabled for cameras: PowerShot A5, PowerShot A5 ZOOM");
@@ -1017,8 +1017,9 @@ put_file_func (CameraFilesystem *fs, const char *folder, CameraFile *file, void
return GP_ERROR;
gp_camera_get_abilities (camera, &a);
if ((camera->pl->speed > 57600) && ((camera->pl->md->model == CANON_PS_A50)
|| (camera->pl->md->model == CANON_PS_PRO70))) {
/* Special case for A50 and Pro 70 */
if ((camera->pl->speed > 57600) && ((camera->pl->md->model == CANON_CLASS_1)
|| (camera->pl->md->model == CANON_CLASS_2))) {
gp_context_error (context,
_("Speeds greater than 57600 are not supported for uploading to this camera"));
return GP_ERROR_NOT_SUPPORTED;
@@ -1144,8 +1145,9 @@ put_file_func (CameraFilesystem *fs, const char *folder, CameraFile *file, void
return GP_ERROR;
gp_camera_get_abilities (camera, &a);
if ((camera->pl->speed > 57600) && ((camera->pl->md->model == CANON_PS_A50)
|| (camera->pl->md->model == CANON_PS_PRO70))) {
/* Special case for A50 and Pro 70 */
if ((camera->pl->speed > 57600) && ((camera->pl->md->model == CANON_CLASS_1)
|| (camera->pl->md->model == CANON_CLASS_2))) {
gp_context_error (context,
_("Speeds greater than 57600 are not supported for uploading to this camera"));
return GP_ERROR_NOT_SUPPORTED;
@@ -1369,7 +1371,7 @@ camera_set_config (Camera *camera, CameraWidget *window, GPContext *context)
gp_widget_get_child_by_label (window, _("Keep filename on upload"), &w);
if (gp_widget_changed (w)) {
gp_widget_get_value (w, &camera->pl->upload_keep_filename);
GP_DEBUG ("New config value for tmb: %i", &camera->pl->upload_keep_filename);
GP_DEBUG ("New config value for tmb: %i", camera->pl->upload_keep_filename);
}
#endif /* CANON_EXPERIMENTAL_UPLOAD */
@@ -1401,7 +1403,7 @@ get_info_func (CameraFilesystem *fs, const char *folder, const char *filename,
else if (is_audio (filename))
strcpy (info->file.type, GP_MIME_WAV);
else
/* May no be correct behaviour ... */
/* May not be correct behaviour ... */
strcpy (info->file.type, "unknown");
strcpy (info->file.name, filename);

View File

@@ -779,17 +779,17 @@ canon_serial_recv_msg (Camera *camera, unsigned char mtype, unsigned char dir, i
}
if (camera->pl->receive_error == NOERROR) {
/*we want to be sure the camera U N D E R S T A N D S our packets */
if (camera->pl->uploading == 1 && camera->pl->md->model == CANON_PS_A50)
if (camera->pl->uploading == 1 && camera->pl->md->model == CANON_CLASS_1)
camera->pl->slow_send = 1;
if (!canon_serial_send_packet
(camera, PKT_ACK, camera->pl->seq_rx++,
camera->pl->psa50_eot + PKT_HDR_LEN, 0)) {
if (camera->pl->uploading == 1
&& camera->pl->md->model == CANON_PS_A50)
&& camera->pl->md->model == CANON_CLASS_1)
camera->pl->slow_send = 0;
return NULL;
}
if (camera->pl->uploading == 1 && camera->pl->md->model == CANON_PS_A50)
if (camera->pl->uploading == 1 && camera->pl->md->model == CANON_CLASS_1)
camera->pl->slow_send = 0;
if (total)
*total = msg_pos;
@@ -1058,7 +1058,7 @@ canon_serial_get_file (Camera *camera, const char *name, int *length, GPContext
if (!file) {
total = le32atoh (msg + 4);
if (total > camera->pl->md->max_movie_size) {
if (total > camera->pl->md->max_picture_size) {
GP_DEBUG ("ERROR: %d is too big\n", total);
break;
}
@@ -1389,9 +1389,8 @@ canon_serial_ready (Camera *camera, GPContext *context)
/* take care of some model specific things */
switch (camera->pl->md->model) {
case CANON_PS_A5:
case CANON_PS_A5_ZOOM:
case CANON_PS_A50:
case CANON_CLASS_3:
case CANON_CLASS_1:
if (camera->pl->speed > 57600)
camera->pl->slow_send = 1;
break;

View File

@@ -320,91 +320,15 @@ canon_usb_lock_keys (Camera *camera, GPContext *context)
GP_DEBUG ("canon_usb_lock_keys()");
switch (camera->pl->md->model) {
case CANON_PS_G1:
case CANON_PS_S100:
case CANON_PS_S20:
case CANON_PS_S10:
case CANON_CLASS_0:
GP_DEBUG ("canon_usb_lock_keys: Your camera model does not need the keylock.");
break;
case CANON_PS_PRO90_IS:
GP_DEBUG ("canon_usb_lock_keys: Your camera model does not support keylocking.");
break;
case CANON_EOS_D30:
case CANON_EOS_D60:
case CANON_EOS_10D:
case CANON_EOS_300D:
case CANON_PS_S230:
case CANON_PS_S400:
GP_DEBUG ("Locking camera keys and turning off LCD using 'EOS' locking code...");
memset (payload, 0, sizeof (payload));
payload[0] = 0x06;
c_res = canon_usb_dialogue (camera, CANON_USB_FUNCTION_EOS_LOCK_KEYS,
&bytes_read, payload, 4);
if (!c_res)
return GP_ERROR;
if (bytes_read == 0x4) {
GP_DEBUG ("canon_usb_lock_keys: Got the expected number of bytes back.");
} else {
gp_context_error (context,
_("canon_usb_lock_keys: "
"Unexpected amount of data returned (%i bytes, expected %i)"),
bytes_read, 0x4);
return GP_ERROR;
}
break;
case CANON_PS_S45:
case CANON_PS_S50:
case CANON_PS_G3:
case CANON_PS_G5:
default:
/* Special case: doesn't implement "get
picture abilities", but isn't an EOS
camera, so we have to use the "normal" key
lock command. Since the S45 is a relatively
new model (in Jan. 2003), I suspect that we
will find more cameras in the future that
work this way. */
GP_DEBUG ("Locking camera keys and turning off LCD using special-case S45 locking code...");
c_res = canon_usb_dialogue (camera,
CANON_USB_FUNCTION_GENERIC_LOCK_KEYS,
&bytes_read, NULL, 0);
if (bytes_read == 0x4) {
GP_DEBUG ("canon_usb_lock_keys: Got the expected number of bytes back.");
} else {
gp_context_error (context,
_("canon_usb_lock_keys: "
"Unexpected amount of data returned (%i bytes, expected %i)"),
bytes_read, 0x4);
return GP_ERROR;
}
break;
case CANON_PS_A5:
case CANON_PS_A5_ZOOM:
case CANON_PS_A50:
case CANON_PS_S30:
case CANON_PS_S40:
case CANON_PS_PRO70:
case CANON_PS_S300:
case CANON_PS_G2:
case CANON_PS_A10:
case CANON_PS_A20:
case CANON_PS_A30:
case CANON_PS_A40:
case CANON_PS_S330:
case CANON_PS_S200:
case CANON_PS_A100:
case CANON_PS_A200:
case CANON_OPT_200:
case CANON_PS_A80:
case CANON_CLASS_1:
case CANON_CLASS_2:
case CANON_CLASS_3:
/* Previous default; I doubt that any new
* cameras will work this way, so it now is
* explicit for the older cameras that use
* it. */
* cameras will work this way. */
GP_DEBUG ("Locking camera keys and turning off LCD using 'normal' locking code...");
c_res = canon_usb_dialogue (camera,
@@ -432,6 +356,51 @@ canon_usb_lock_keys (Camera *camera, GPContext *context)
return GP_ERROR;
}
break;
case CANON_CLASS_4:
GP_DEBUG ("Locking camera keys and turning off LCD using 'EOS' locking code...");
memset (payload, 0, sizeof (payload));
payload[0] = 0x06;
c_res = canon_usb_dialogue (camera, CANON_USB_FUNCTION_EOS_LOCK_KEYS,
&bytes_read, payload, 4);
if (!c_res)
return GP_ERROR;
if (bytes_read == 0x4) {
GP_DEBUG ("canon_usb_lock_keys: Got the expected number of bytes back.");
} else {
gp_context_error (context,
_("canon_usb_lock_keys: "
"Unexpected amount of data returned (%i bytes, expected %i)"),
bytes_read, 0x4);
return GP_ERROR;
}
break;
case CANON_CLASS_5:
/* Doesn't implement "get
picture abilities", but isn't an EOS
camera, so we have to use the "normal" key
lock command. Since the S45 is a relatively
new model (in Jan. 2003), I suspect that we
will find more cameras in the future that
work this way. */
GP_DEBUG ("Locking camera keys and turning off LCD using special-case S45 locking code...");
c_res = canon_usb_dialogue (camera,
CANON_USB_FUNCTION_GENERIC_LOCK_KEYS,
&bytes_read, NULL, 0);
if (bytes_read == 0x4) {
GP_DEBUG ("canon_usb_lock_keys: Got the expected number of bytes back.");
} else {
gp_context_error (context,
_("canon_usb_lock_keys: "
"Unexpected amount of data returned (%i bytes, expected %i)"),
bytes_read, 0x4);
return GP_ERROR;
}
break;
}
return GP_OK;
@@ -455,36 +424,28 @@ canon_usb_unlock_keys (Camera *camera, GPContext *context)
GP_DEBUG ("canon_usb_unlock_keys()");
switch (camera->pl->md->model) {
case CANON_EOS_D30:
case CANON_EOS_D60:
case CANON_EOS_10D:
case CANON_EOS_300D:
case CANON_PS_S230:
case CANON_PS_S400:
c_res = canon_usb_dialogue (camera, CANON_USB_FUNCTION_EOS_UNLOCK_KEYS,
&bytes_read, NULL, 0);
if (!c_res)
return GP_ERROR;
if (bytes_read == 0x4) {
GP_DEBUG ("canon_usb_unlock_keys: Got the expected number of bytes back.");
} else {
gp_context_error (context,
_("canon_usb_unlock_keys: "
"Unexpected amount of data returned (%i bytes, expected %i)"),
bytes_read, 0x4);
return GP_ERROR;
}
break;
default:
/* Your camera model does not need unlocking, cannot do unlocking or
* we don't know how to unlock it's keys.
*/
GP_DEBUG ("canon_usb_unlock_keys: Not unlocking the kind of camera you have.\n"
"If unlocking works when using the Windows software with your camera,\n"
"please contact %s.", MAIL_GPHOTO_DEVEL);
break;
if ( camera->pl->md->model == CANON_CLASS_4 ) {
c_res = canon_usb_dialogue (camera, CANON_USB_FUNCTION_EOS_UNLOCK_KEYS,
&bytes_read, NULL, 0);
if (!c_res)
return GP_ERROR;
if (bytes_read == 0x4) {
GP_DEBUG ("canon_usb_unlock_keys: Got the expected number of bytes back.");
} else {
gp_context_error (context,
_("canon_usb_unlock_keys: "
"Unexpected amount of data returned (%i bytes, expected %i)"),
bytes_read, 0x4);
return GP_ERROR;
}
}
else {
/* Your camera model does not need unlocking, cannot do unlocking or
* we don't know how to unlock it's keys.
*/
GP_DEBUG ("canon_usb_unlock_keys: Not unlocking the kind of camera you have.\n"
"If unlocking works when using the Windows software with your camera,\n"
"please contact %s.", MAIL_GPHOTO_DEVEL);
}
return GP_OK;
@@ -1376,6 +1337,67 @@ int canon_usb_set_file_time ( Camera *camera, char *camera_filename, time_t time
return GP_OK;
}
/**
* canon_usb_set_file_attributes:
* @camera: camera to initialize
* @attr_bits: bits to write in the camera directory entry
* @pathname: pathname of file whose attributes are to be changed.
* @context: context for error reporting
*
* Changes the attribute bits in a specified directory entry.
*
* Returns: gphoto2 error code
*
*/
int
canon_usb_set_file_attributes (Camera *camera, unsigned short attr_bits,
const char *pathname, GPContext *context)
{
/* Pathname string plus 32-bit parameter plus two NULs. */
unsigned int payload_length = strlen(pathname) + 6;
unsigned char *payload = malloc ( payload_length );
int bytes_read;
unsigned char *res;
GP_DEBUG ( "canon_usb_set_file_attributes()" );
/* build payload :
*
* <attr bits> pathname 0x00 0x00
*
* The attribute bits will be a 32-bit little-endian integer.
* NOTE: the first 0x00 after dirname is the NULL byte terminating
* the string, so payload_length is strlen(dirname) + 4
*/
memset (payload, 0x00, payload_length);
memcpy (payload + 4, pathname, strlen (pathname));
htole32a ( payload, (unsigned long)attr_bits );
/* 1024 * 1024 is max realistic data size, out of the blue.
* 0 is to not show progress status
*/
res = canon_usb_dialogue ( camera, CANON_USB_FUNCTION_SET_ATTR, &bytes_read,
payload, payload_length );
if ( res == NULL ) {
gp_context_error (context,
_("canon_usb_set_file_attributes: "
"canon_usb_dialogue failed"));
free ( payload );
return GP_ERROR;
}
else if ( le32atoh ( res+0x50 ) != 0 ) {
gp_context_error (context,
_("canon_usb_set_file_attributes: "
"canon_usb_dialogue returned error status 0x%08x from camera"),
le32atoh ( res+0x50 ) );
free ( payload );
return GP_ERROR;
}
free ( payload );
return GP_OK;
}
/**
* canon_usb_put_file:
* @camera: camera to lock keys on
@@ -1413,7 +1435,7 @@ canon_usb_put_file (Camera *camera, CameraFile *file, char *destname, char *dest
long int offs = 0;
char filename[256];
int filename_len;
const char *data;
char *data;
char *newdata = NULL;
long int size; /* Total size of file to upload */
FILE *fi;
@@ -1439,7 +1461,7 @@ canon_usb_put_file (Camera *camera, CameraFile *file, char *destname, char *dest
CHECK_RESULT (gp_file_get_name (file, &srcname));
/* Open input file and read all its data into a buffer. */
if(!gp_file_get_data_and_size (file, &data, &size)) {
if(!gp_file_get_data_and_size (file, (const char **)&data, &size)) {
fi = fopen(srcname, "rb");
if(!fi) {
gp_context_error(context, _("Couldn't read from file \"%s\""), srcname);
@@ -1452,7 +1474,7 @@ canon_usb_put_file (Camera *camera, CameraFile *file, char *destname, char *dest
fseek(fi, 0, SEEK_SET);
newdata = data = malloc(size);
if(!newdata) {
gp_context_error(context, _("Out of memory: %d bytes needed."), size);
gp_context_error(context, _("Out of memory: %ld bytes needed."), size);
free(packet);
return GP_ERROR_NO_MEMORY;
}
@@ -1461,7 +1483,7 @@ canon_usb_put_file (Camera *camera, CameraFile *file, char *destname, char *dest
}
GP_DEBUG ( "canon_put_file_usb:"
" finished reading file, %d bytes (0x%x)",
" finished reading file, %ld bytes (0x%lx)",
size, size );
/* Take the buffer and send it to the camera, breaking it into
@@ -1472,7 +1494,7 @@ canon_usb_put_file (Camera *camera, CameraFile *file, char *destname, char *dest
len2 = size - offs;
len1 = len2 + 0x1c + filename_len + 1;
GP_DEBUG ( "canon_put_file_usb: len1=%x, len2=%x", len1, len2 );
GP_DEBUG ( "canon_put_file_usb: len1=%lx, len2=%lx", len1, len2 );
memset(packet, 0, 0x40);
packet[4]=3;
@@ -1531,7 +1553,7 @@ canon_usb_put_file (Camera *camera, CameraFile *file, char *destname, char *dest
status = gp_port_write (camera->port, packet, len1+0x40);
if (status != len1+0x40) {
GP_DEBUG ("canon_put_file_usb: write 2 failed! "
"(returned %i, expected %i)", status, len1+0x40);
"(returned %i, expected %li)", status, len1+0x40);
gp_context_error(context, _("File upload failed."));
if(newdata)
free(newdata);
@@ -1716,67 +1738,6 @@ canon_usb_list_all_dirs (Camera *camera, unsigned char **dirent_data,
return GP_OK;
}
/**
* canon_usb_set_file_attributes:
* @camera: camera to initialize
* @attr_bits: bits to write in the camera directory entry
* @pathname: pathname of file whose attributes are to be changed.
* @context: context for error reporting
*
* Changes the attribute bits in a specified directory entry.
*
* Returns: gphoto2 error code
*
*/
int
canon_usb_set_file_attributes (Camera *camera, unsigned short attr_bits,
const char *pathname, GPContext *context)
{
/* Pathname string plus 32-bit parameter plus two NULs. */
unsigned int payload_length = strlen(pathname) + 6;
unsigned char *payload = malloc ( payload_length );
int bytes_read;
unsigned char *res;
GP_DEBUG ( "canon_usb_set_file_attributes()" );
/* build payload :
*
* <attr bits> pathname 0x00 0x00
*
* The attribute bits will be a 32-bit little-endian integer.
* NOTE: the first 0x00 after dirname is the NULL byte terminating
* the string, so payload_length is strlen(dirname) + 4
*/
memset (payload, 0x00, payload_length);
memcpy (payload + 4, pathname, strlen (pathname));
htole32a ( payload, (unsigned long)attr_bits );
/* 1024 * 1024 is max realistic data size, out of the blue.
* 0 is to not show progress status
*/
res = canon_usb_dialogue ( camera, CANON_USB_FUNCTION_SET_ATTR, &bytes_read,
payload, payload_length );
if ( res == NULL ) {
gp_context_error (context,
_("canon_usb_set_file_attributes: "
"canon_usb_dialogue failed"));
free ( payload );
return GP_ERROR;
}
else if ( le32atoh ( res+0x50 ) != 0 ) {
gp_context_error (context,
_("canon_usb_set_file_attributes: "
"canon_usb_dialogue returned error status 0x%08x from camera"),
le32atoh ( res+0x50 ) );
free ( payload );
return GP_ERROR;
}
free ( payload );
return GP_OK;
}
/**
* canon_usb_ready:
* @camera: camera to get ready
@@ -1835,7 +1796,7 @@ canon_usb_identify (Camera *camera, GPContext *context)
&& models[i].usb_product
&& (a.usb_vendor == models[i].usb_vendor)
&& (a.usb_product == models[i].usb_product)) {
GP_DEBUG ("canon_usb_identify: USB ID match 0x%04x:0x%04x (%s)",
GP_DEBUG ("canon_usb_identify: USB ID match 0x%04x:0x%04x (model name \"%s\")",
models[i].usb_vendor, models[i].usb_product, models[i].id_str);
gp_context_status (context, _("Detected a '%s'."), models[i].id_str);
camera->pl->md = (struct canonCamModelData *) &models[i];