diff options
author | Theodore Kilgore <kilgota@auburn.edu> | 2007-12-28 23:56:39 +0000 |
---|---|---|
committer | Theodore Kilgore <kilgota@auburn.edu> | 2007-12-28 23:56:39 +0000 |
commit | 9d8348757ce9505657f1375881bf11616b5341e3 (patch) | |
tree | 10aec40f76a2e53cbcbfdec36ef2c223be70c4e1 /camlibs/jl2005c | |
parent | 398dc2e2863179116c538fbd5f46a344c8476f85 (diff) | |
download | libgphoto2-9d8348757ce9505657f1375881bf11616b5341e3.tar.gz |
Added several cameras to camlibs/jl2005c and incorporated basic support for JL2005B, too.
git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@10908 67ed7778-7388-44ab-90cf-0a291f65f57c
Diffstat (limited to 'camlibs/jl2005c')
-rw-r--r-- | camlibs/jl2005c/ChangeLog | 12 | ||||
-rw-r--r-- | camlibs/jl2005c/jl2005c.c | 61 | ||||
-rw-r--r-- | camlibs/jl2005c/jl2005c.h | 6 | ||||
-rw-r--r-- | camlibs/jl2005c/library.c | 16 |
4 files changed, 71 insertions, 24 deletions
diff --git a/camlibs/jl2005c/ChangeLog b/camlibs/jl2005c/ChangeLog index 3c2e161c8..76303d02c 100644 --- a/camlibs/jl2005c/ChangeLog +++ b/camlibs/jl2005c/ChangeLog @@ -1,3 +1,15 @@ +2007-12-28 Theodore Kilgore <kilgota@auburn.edu> + * library.c: Added support for "Amazing Spiderman" reported by + Victor Hodge <vhodge@sympatico.ca> and for + Sakar no. 75379 reported by + Patrick Simmons <linuxrocks123@netscape.net> and for + Sakar Kidz-Cam no. 88379 reported by + Martin Laberge <mlsoft@videotron.ca>. + * *.[c,h]: Introduced changes to give unified support to both + JL2005C and JL2005B in the same functions. + NOTE: All these cameras use compression, and how to + decompress is still unknown. + 2007-09-04 Theodore Kilgore <kilgota@auburn.edu> * *.[c,h]: First check-in of experimental driver code. Nothing diff --git a/camlibs/jl2005c/jl2005c.c b/camlibs/jl2005c/jl2005c.c index 7474889dc..a44f1bcf3 100644 --- a/camlibs/jl2005c/jl2005c.c +++ b/camlibs/jl2005c/jl2005c.c @@ -39,6 +39,7 @@ jl2005c_init (Camera *camera, GPPort *port, CameraPrivateLibrary *priv) { unsigned char command[2]; char response; + char model_string[4]; unsigned char info[0xe000]; int info_block_size = 0; memset(info,0, sizeof(info)); @@ -52,22 +53,24 @@ jl2005c_init (Camera *camera, GPPort *port, CameraPrivateLibrary *priv) gp_port_write (port, "\x95\x60", 2); usleep (10000); gp_port_read (port, &response, 1); - + model_string[0]=response; usleep (10000); gp_port_write (port, "\x95\x61", 2); usleep (10000); gp_port_read (port, &response, 1); - + model_string[1]=response; usleep (10000); gp_port_write (port, "\x95\x62", 2); usleep (10000); gp_port_read (port, &response, 1); - + model_string[2]=response; usleep (10000); gp_port_write (port,"\x95\x63" , 2); usleep (10000); gp_port_read (port, &response, 1); - + model_string[3]=response; + GP_DEBUG("Model string is %02x%02x%02x%02x\n",model_string[0], model_string[1], + model_string[2], model_string[3]); usleep (10000); gp_port_write (port, "\x95\x64", 2); usleep (10000); @@ -85,7 +88,7 @@ jl2005c_init (Camera *camera, GPPort *port, CameraPrivateLibrary *priv) info_block_size += 0x200 - (info_block_size%0x200); usleep (10000); - gp_port_write (port, "\x95\x66", 2); + gp_port_write (port, "\x95\x66", 2); usleep (10000); gp_port_read (port, &response, 1); usleep (10000); @@ -152,35 +155,61 @@ jl2005c_init (Camera *camera, GPPort *port, CameraPrivateLibrary *priv) usleep (10000); gp_port_read(port, (char *)info, info_block_size); usleep (10000); - gp_port_write (port, "\x0b\x00",2); + gp_port_write (port, "\x0b\x00",2); usleep (10000); memmove(priv->info, info, info_block_size); + priv->model=info[6]; + GP_DEBUG("Leaving jl2005c_init\n"); return GP_OK; } int -jl2005c_get_pic_data_size (Info *info, int n) +jl2005c_get_pic_data_size (CameraPrivateLibrary *priv, Info *info, int n) { int size; + unsigned char model=priv->model; GP_DEBUG("info[48+16*n+7] = %02X\n", info[48+16*n+7]); - size = (info[48+16*n+7]*0x200); + size = info[0x30+0x10*n+6]*0x100+info[0x30+0x10*n+7]; + switch (model) { + case 0x43: + size *= 0x200; + break; + case 0x42: + size *= 0x80; + break; + default: + GP_DEBUG("Unknown model, unknown size\n"); + return GP_ERROR_NOT_SUPPORTED; + } GP_DEBUG("size = 0x%x = %d\n", size, size); return (size); } unsigned long -jl2005c_get_start_of_photo(Info *info, unsigned int n) +jl2005c_get_start_of_photo(CameraPrivateLibrary *priv, Info *info, + unsigned int n) { - unsigned long start = 0; - start = (info[48+16*n+12]&0xff)*0x100; - start -= 0x400; - start += info[48+16*n+13]&0xff; - start *= 0x200; - + unsigned long start; + unsigned char model = priv->model; + start = info[0x30+0x10*n+0x0c]*0x100+ + info[0x30+0x10*n+0x0d]; + start -= info[0x30+0x0c]*0x100+ + info[0x30+0x0d]; + switch (model) { + case 0x43: + start *= 0x200; + break; + case 0x42: + start *= 0x80; + break; + default: + GP_DEBUG("Unknown model\n"); + return GP_ERROR_NOT_SUPPORTED; + } return start; -} +} int diff --git a/camlibs/jl2005c/jl2005c.h b/camlibs/jl2005c/jl2005c.h index 93033654f..eeccaf88b 100644 --- a/camlibs/jl2005c/jl2005c.h +++ b/camlibs/jl2005c/jl2005c.h @@ -27,6 +27,7 @@ typedef unsigned char Info; struct _CameraPrivateLibrary { + unsigned char model; unsigned char *catalog; int nb_entries; int last_fetched_entry; @@ -48,8 +49,9 @@ int jl2005c_get_resolution (Info *info, int n); int jl2005c_get_compression (Info *info, int n); int jl2005c_get_width (Info *info, int n); -int jl2005c_get_pic_data_size (Info *info, int n); -unsigned long jl2005c_get_start_of_photo(Info *info, unsigned int n); +int jl2005c_get_pic_data_size (CameraPrivateLibrary *priv, Info *info, int n); +unsigned long jl2005c_get_start_of_photo(CameraPrivateLibrary *priv, + Info *info, unsigned int n); int set_usb_in_endpoint (Camera *camera, int inep); int jl2005c_get_picture_data (GPPort *port, char *data, int size); #endif diff --git a/camlibs/jl2005c/library.c b/camlibs/jl2005c/library.c index 22c6ab3d1..68a119918 100644 --- a/camlibs/jl2005c/library.c +++ b/camlibs/jl2005c/library.c @@ -57,7 +57,9 @@ struct { unsigned short idProduct; } models[] = { {"Argus DC1512e", GP_DRIVER_STATUS_EXPERIMENTAL, 0x0979, 0x0227}, -/* {"American Idol", GP_DRIVER_STATUS_EXPERIMENTAL, 0x0979, 0x0224},*/ + {"Amazing Spiderman", GP_DRIVER_STATUS_EXPERIMENTAL, 0x0979, 0x0227}, + {"Sakar no. 75379", GP_DRIVER_STATUS_EXPERIMENTAL, 0x0979, 0x0227}, + {"Sakar Kidz-Cam no. 88379", GP_DRIVER_STATUS_EXPERIMENTAL, 0x0979, 0x0227}, {NULL,0,0,0} }; @@ -100,8 +102,9 @@ camera_summary (Camera *camera, CameraText *summary, GPContext *context) int num_pics; num_pics = camera->pl->nb_entries; GP_DEBUG("camera->pl->nb_entries = %i\n",camera->pl->nb_entries); - sprintf (summary->text,_("This camera contains a Jeilin JL2005C chipset.\n" - "The number of photos in it is %i. \n"), num_pics); + sprintf (summary->text,_("This camera contains a Jeilin JL2005%c chipset.\n" + "The number of photos in it is %i. \n"), + camera->pl->model, num_pics); return GP_OK; } @@ -198,11 +201,12 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename, return GP_ERROR; } - GP_DEBUG ("height is %i\n", h); + GP_DEBUG ("height is %i\n", h); - b = jl2005c_get_pic_data_size(camera->pl->info, k); + b = jl2005c_get_pic_data_size(camera->pl, camera->pl->info, k); GP_DEBUG("b = %i = 0x%x bytes\n", b,b); - start_of_photo = jl2005c_get_start_of_photo(camera->pl->info, k); + start_of_photo = jl2005c_get_start_of_photo(camera->pl, + camera->pl->info, k); GP_DEBUG("start_of_photo number %i = 0x%lx \n", k,start_of_photo); pic_data = malloc (b+1); if (!pic_data) return GP_ERROR_NO_MEMORY; |