2001-09-27 Lutz M�ller <urc8@rz.uni-karlsruhe.de>
* camlibs/sierra/protocol.c:
* camlibs/sierra/sierra.c: Gilles Grandou <gilles@grandou.net>
figured out how to retrieve date and software revision.
* configure.in:
* camlibs/jd350e: New driver from Michael Trawny <trawny99@yahoo.com>
git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@2336 67ed7778-7388-44ab-90cf-0a291f65f57c
This commit is contained in:
@@ -1,3 +1,11 @@
|
||||
2001-09-27 Lutz Müller <urc8@rz.uni-karlsruhe.de>
|
||||
|
||||
* camlibs/sierra/protocol.c:
|
||||
* camlibs/sierra/sierra.c: Gilles Grandou <gilles@grandou.net>
|
||||
figured out how to retrieve date and software revision.
|
||||
* configure.in:
|
||||
* camlibs/jd350e: New driver from Michael Trawny <trawny99@yahoo.com>
|
||||
|
||||
2001-09-25 Lutz Müller <urc8@rz.uni-karlsruhe.de>
|
||||
|
||||
* libgphoto2/jpeg.h: Fix a warning
|
||||
|
||||
6
camlibs/jd350e/.cvsignore
Normal file
6
camlibs/jd350e/.cvsignore
Normal file
@@ -0,0 +1,6 @@
|
||||
*.la
|
||||
*.lo
|
||||
.libs
|
||||
.deps
|
||||
Makefile
|
||||
Makefile.in
|
||||
12
camlibs/jd350e/CREDITS
Normal file
12
camlibs/jd350e/CREDITS
Normal file
@@ -0,0 +1,12 @@
|
||||
Michael Trawny <trawny99@yahoo.com>
|
||||
JD350e serial protocol reverse engineering
|
||||
Driver implementation
|
||||
|
||||
Thanks to:
|
||||
|
||||
Eric Brombaugh <emeb@goodnet.com>
|
||||
Pattern recognition based bayer->RGB demosaic routine
|
||||
|
||||
Mark Russinovich <http://www.sysinternals.com> for making his Portmon serial port analysis software freely available.
|
||||
|
||||
Adam Harrison <adam@antispin.org>, the author of the STV0680 camlib, whose code was used as a template for this driver.
|
||||
280
camlibs/jd350e/LICENCE
Normal file
280
camlibs/jd350e/LICENCE
Normal file
@@ -0,0 +1,280 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
12
camlibs/jd350e/Makefile.am
Normal file
12
camlibs/jd350e/Makefile.am
Normal file
@@ -0,0 +1,12 @@
|
||||
camlibdir = $(prefix)/lib/gphoto2
|
||||
camlib_LTLIBRARIES = libgphoto2_jd350e.la
|
||||
|
||||
INCLUDES = -I$(top_srcdir)/include
|
||||
|
||||
libgphoto2_jd350e_la_SOURCES = jd350e.c jd350e.h library.c library.h bayer.c bayer.h
|
||||
|
||||
libgphoto2_jd350e_la_LDFLAGS =\
|
||||
-avoid-version\
|
||||
-L$(shell pwd)/$(top_builddir)/libgphoto2/@dotlibs@
|
||||
|
||||
libgphoto2_jd350e_la_LIBADD = -lgphoto2
|
||||
100
camlibs/jd350e/bayer.c
Normal file
100
camlibs/jd350e/bayer.c
Normal file
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* Bases on STV0680 Vision Camera Chipset Driver
|
||||
* Copyright (C) 2000 Adam Harrison <adam@antispin.org>
|
||||
*
|
||||
* bayer_unshuffle() adapted to Jenoptik JD350e raw images
|
||||
* format by Michael Trawny <trawny99@yahoo.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "redcurve.h" // mtr: correction curve for red values
|
||||
#include "bayer.h"
|
||||
|
||||
void bayer_unshuffle(int w, int h, unsigned char *raw, unsigned char *output)
|
||||
{
|
||||
int x, y, i,j, p;
|
||||
int colour, bayer;
|
||||
|
||||
for(i=0,j=w*h-1; i<j; i++,j--){ // mtr: rotate raw 180 degrees
|
||||
unsigned char t = raw[i];
|
||||
raw[i] = raw[j];
|
||||
raw[j] = t;
|
||||
}
|
||||
|
||||
for(y = 0; y < h; ++y) {
|
||||
for(x = 0; x < w; ++x) {
|
||||
//p = x & 1 ? raw[(y*w) + (x >> 1)] : raw[(y*w) + (x>>1) + (w >> 1)];
|
||||
p = raw[(y*w) + x]; // mtr
|
||||
|
||||
bayer = (y&1?2:0) + (x&1?1:0);
|
||||
|
||||
switch(bayer) {
|
||||
case 0:
|
||||
case 3: colour = 1; break;
|
||||
case 1: colour = 0; break;
|
||||
case 2: colour = 2; break;
|
||||
}
|
||||
|
||||
i = (y * w + x) * 3;
|
||||
|
||||
output[i] = 0;
|
||||
output[i+1] = 0;
|
||||
output[i+2] = 0;
|
||||
output[i+colour] = p;
|
||||
output[i] = red_curve[output[i]]; // mtr: apply color correction curve
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define ISEVEN(a) (((a)&1)!=1)
|
||||
#define GETADD(x, y) ((3*(x))+(356*3*(y)))
|
||||
#define RED 0
|
||||
#define GREEN 1
|
||||
#define BLUE 2
|
||||
|
||||
#define AD(x, y, w) ((y)*(w)*3+3*(x))
|
||||
|
||||
void bayer_demosaic(int w, int h, unsigned char *image)
|
||||
{
|
||||
int x, y, bayer;
|
||||
|
||||
for(y = 1; y < (h - 2); y++) {
|
||||
for(x = 1; x < (w - 2); x++) {
|
||||
// work out pixel type
|
||||
bayer = (x&1?0:1) + (y&1?0:2);
|
||||
|
||||
switch(bayer) {
|
||||
case 0: // green. blue lr, red tb
|
||||
image[AD(x,y,w) + BLUE] = image[AD(x-1,y,w)+BLUE];
|
||||
image[AD(x,y,w) + RED] = image[AD(x,y-1,w)+RED];
|
||||
break;
|
||||
case 1: // blue. green lrtb, red diagonals
|
||||
image[AD(x,y,w)+GREEN] =image[AD(x-1,y,w)+GREEN];
|
||||
image[AD(x,y,w)+RED] =image[AD(x-1,y-1,w)+RED];
|
||||
break;
|
||||
case 2: // red. green lrtb, blue diagonals
|
||||
image[AD(x,y,w)+GREEN] =image[AD(x-1,y,w)+GREEN];
|
||||
image[AD(x,y,w)+BLUE] =image[AD(x-1,y-1,w)+BLUE];
|
||||
break;
|
||||
case 3: // green. red lr, blue tb
|
||||
image[AD(x,y,w)+RED] =image[AD(x-1,y,w)+RED];
|
||||
image[AD(x,y,w)+BLUE] =image[AD(x,y-1,w)+BLUE];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
26
camlibs/jd350e/bayer.h
Normal file
26
camlibs/jd350e/bayer.h
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* STV0680 Vision Camera Chipset Driver
|
||||
* Copyright (C) 2000 Adam Harrison <adam@antispin.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef BAYER_H
|
||||
#define BAYER_H
|
||||
|
||||
void bayer_unshuffle(int w, int h, unsigned char *raw, unsigned char *output);
|
||||
void bayer_demosaic(int w, int h, unsigned char *image);
|
||||
|
||||
#endif
|
||||
250
camlibs/jd350e/jd350e.c
Normal file
250
camlibs/jd350e/jd350e.c
Normal file
@@ -0,0 +1,250 @@
|
||||
/*
|
||||
* Jenoptik JD350e Driver
|
||||
* Copyright (C) 2001 Michael Trawny <trawny99@yahoo.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include <string.h>
|
||||
#include <gphoto2.h>
|
||||
#include <gphoto2-port.h>
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
# include <libintl.h>
|
||||
# undef _
|
||||
# define _(String) dgettext (PACKAGE, String)
|
||||
# ifdef gettext_noop
|
||||
# define N_(String) gettext_noop (String)
|
||||
# else
|
||||
# define _(String) (String)
|
||||
# define N_(String) (String)
|
||||
# endif
|
||||
#else
|
||||
# define _(String) (String)
|
||||
# define N_(String) (String)
|
||||
#endif
|
||||
|
||||
#include "jd350e.h"
|
||||
#include "library.h"
|
||||
|
||||
int camera_id (CameraText *id)
|
||||
{
|
||||
strcpy(id->text, "JD350e");
|
||||
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
int camera_abilities (CameraAbilitiesList *list)
|
||||
{
|
||||
CameraAbilities *a;
|
||||
|
||||
gp_abilities_new(&a);
|
||||
|
||||
strcpy(a->model, "Jenoptik JD350e");
|
||||
a->port = GP_PORT_SERIAL;
|
||||
a->speed[0] = 115200;
|
||||
a->speed[1] = 0;
|
||||
a->operations = GP_OPERATION_NONE;
|
||||
a->file_operations = GP_FILE_OPERATION_PREVIEW;
|
||||
a->folder_operations = GP_FOLDER_OPERATION_NONE;
|
||||
|
||||
gp_abilities_list_append(list, a);
|
||||
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
int camera_exit (Camera *camera) {
|
||||
|
||||
struct jd350e_s *device = camera->camlib_data;
|
||||
|
||||
/* close serial port */
|
||||
gp_port_close(device->gpiod);
|
||||
|
||||
/* free camera filesystem */
|
||||
gp_filesystem_free(device->fs);
|
||||
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
int camera_folder_list_folders (Camera *camera, const char *folder,
|
||||
CameraList *list)
|
||||
{
|
||||
/* jd350e_s has no folder support */
|
||||
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
int camera_folder_list_files (Camera *camera, const char *folder,
|
||||
CameraList *list)
|
||||
{
|
||||
struct jd350e_s *device = camera->camlib_data;
|
||||
int i, count, result;
|
||||
const char *name;
|
||||
|
||||
result = jd350e_file_count(device, &count);
|
||||
if (result != GP_OK)
|
||||
return result;
|
||||
|
||||
gp_filesystem_populate(device->fs, "/", "image%02i.pnm", count);
|
||||
|
||||
for(i = 0; i < gp_filesystem_count(device->fs, folder); ++i) {
|
||||
gp_filesystem_name(device->fs, folder, i, &name);
|
||||
gp_list_append(list, name, NULL);
|
||||
}
|
||||
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
int camera_file_get (Camera *camera, const char *folder, const char *filename,
|
||||
CameraFileType type, CameraFile *file )
|
||||
{
|
||||
struct jd350e_s *device = camera->camlib_data;
|
||||
int image_no, count, result;
|
||||
char *data;
|
||||
long int size;
|
||||
|
||||
result = jd350e_file_count(device, &count);
|
||||
if (result != GP_OK)
|
||||
return result;
|
||||
|
||||
gp_filesystem_populate(device->fs, "/", "image%02i.pnm", count);
|
||||
|
||||
image_no = gp_filesystem_number(device->fs, folder, filename);
|
||||
|
||||
if(image_no < 0)
|
||||
return image_no;
|
||||
|
||||
switch (type) {
|
||||
case GP_FILE_TYPE_RAW:
|
||||
result = jd350e_get_image_raw (device, image_no, &data,
|
||||
(int*) &size);
|
||||
break;
|
||||
case GP_FILE_TYPE_NORMAL:
|
||||
result = jd350e_get_image_full (device, image_no, &data,
|
||||
(int*) &size);
|
||||
break;
|
||||
case GP_FILE_TYPE_PREVIEW:
|
||||
result = jd350e_get_image_preview (device, image_no, &data,
|
||||
(int*) &size);
|
||||
break;
|
||||
default:
|
||||
return (GP_ERROR_NOT_SUPPORTED);
|
||||
}
|
||||
|
||||
if (result < 0)
|
||||
return result;
|
||||
|
||||
gp_file_set_name (file, filename);
|
||||
gp_file_set_mime_type (file, "image/pnm");
|
||||
gp_file_set_data_and_size (file, data, size);
|
||||
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
int camera_capture (Camera *camera, int capture_type, CameraFilePath *path)
|
||||
{
|
||||
/* XXX implement */
|
||||
|
||||
return (GP_ERROR_NOT_SUPPORTED);
|
||||
}
|
||||
|
||||
int camera_summary (Camera *camera, CameraText *summary)
|
||||
{
|
||||
strcpy(summary->text, _("No summary available."));
|
||||
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
int camera_manual (Camera *camera, CameraText *manual)
|
||||
{
|
||||
strcpy(manual->text,
|
||||
_("The JD350e camera uses a proprietary compression method. This driver is\n"
|
||||
"not yet able to decode compressed images. So please make sure that your pictures\n"
|
||||
"are taken in \"best\" mode if you want to use this driver.\n\n"
|
||||
"An RS232 interface @ 115 kbit is required for image transfer.\n"
|
||||
"USB is not yet supported.\n\n"
|
||||
"The driver allows you to get\n\n"
|
||||
" - interpolated thumbnails (80x60 PPM format)\n"
|
||||
" - interpolated images (640x480 PPM format)\n"
|
||||
" - raw images (640x480 PGM format, Bayer-RGB coded)\n\n"
|
||||
"The pictures are interpolated using the pattrec algorithm by Erik Brombaugh \n"
|
||||
"and Adam Harrison\n\n"
|
||||
"A simple color correction is applied to the interpolated images. It works fine\n"
|
||||
"for daylight but not for indoor pictures.\n\n"));
|
||||
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
int camera_about (Camera *camera, CameraText *about)
|
||||
{
|
||||
strcpy (about->text,
|
||||
_("JD350e\n"
|
||||
"Michael Trawny <trawny99@yahoo.com>\n"
|
||||
"Driver for Jenoptik JD350e cameras (uncompressed mode only!)\n"
|
||||
"Protocol reverse engineered using Portmon"));
|
||||
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
char* camera_result_as_string (Camera *camera, int result)
|
||||
{
|
||||
if (result >= 0) return ("This is not an error...");
|
||||
if (-result < 100) return gp_result_as_string (result);
|
||||
return ("This is a template specific error.");
|
||||
}
|
||||
|
||||
int camera_init (Camera *camera)
|
||||
{
|
||||
gp_port_settings gpiod_settings;
|
||||
int ret;
|
||||
struct jd350e_s *device;
|
||||
|
||||
/* First, set up all the function pointers */
|
||||
camera->functions->exit = camera_exit;
|
||||
camera->functions->folder_list_folders = camera_folder_list_folders;
|
||||
camera->functions->folder_list_files = camera_folder_list_files;
|
||||
camera->functions->file_get = camera_file_get;
|
||||
camera->functions->summary = camera_summary;
|
||||
camera->functions->manual = camera_manual;
|
||||
camera->functions->about = camera_about;
|
||||
camera->functions->result_as_string = camera_result_as_string;
|
||||
|
||||
if((device = malloc(sizeof(struct jd350e_s))) == NULL) {
|
||||
return GP_ERROR_NO_MEMORY;
|
||||
}
|
||||
|
||||
camera->camlib_data = device;
|
||||
|
||||
/* open and configure serial port */
|
||||
if ((ret = gp_port_new(&(device->gpiod), GP_PORT_SERIAL)) < 0)
|
||||
return (ret);
|
||||
|
||||
gp_port_timeout_set(device->gpiod, 1000);
|
||||
|
||||
strcpy(gpiod_settings.serial.port, camera->port_info->path);
|
||||
gpiod_settings.serial.speed = camera->port_info->speed;
|
||||
gpiod_settings.serial.bits = 8;
|
||||
gpiod_settings.serial.parity = 0;
|
||||
gpiod_settings.serial.stopbits = 1;
|
||||
|
||||
gp_port_settings_set(device->gpiod, gpiod_settings);
|
||||
gp_port_open(device->gpiod);
|
||||
|
||||
/* create camera filesystem */
|
||||
gp_filesystem_new(&device->fs);
|
||||
|
||||
/* test camera */
|
||||
return jd350e_ping(device);
|
||||
}
|
||||
|
||||
29
camlibs/jd350e/jd350e.h
Normal file
29
camlibs/jd350e/jd350e.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Jenoptik JD350e Driver
|
||||
* Copyright (C) 2001 Michael Trawny <trawny99@yahoo.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef JD350E_H
|
||||
#define JD350E_H
|
||||
|
||||
struct jd350e_s {
|
||||
gp_port *gpiod;
|
||||
CameraFilesystem *fs;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
303
camlibs/jd350e/library.c
Normal file
303
camlibs/jd350e/library.c
Normal file
@@ -0,0 +1,303 @@
|
||||
/*
|
||||
* Jenoptik JD350e Driver
|
||||
* Copyright (C) 2001 Michael Trawny <trawny99@yahoo.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <gphoto2.h>
|
||||
#include <gphoto2-port.h>
|
||||
|
||||
#include "jd350e.h"
|
||||
#include "library.h"
|
||||
#include "bayer.h"
|
||||
#include "libgphoto2/pattrec.h"
|
||||
|
||||
#define CMD_RETRIES 0x03
|
||||
|
||||
#define CMD_PING 0x41
|
||||
#define CMD_REQUEST_DATA 0x61
|
||||
#define CMD_FETCH_DATA 0x15
|
||||
#define CMD_SET_IMAGE_NUMBER 0xf6
|
||||
#define CMD_SET_IMAGE_NUMBER_RLEN 0x08
|
||||
|
||||
#define CMD_GET_FILE_INFO 0x40
|
||||
#define CMD_GET_FILE_INFO_RLEN 0x501
|
||||
#define CMD_GET_IMAGE 0x00
|
||||
#define CMD_GET_IMAGE_RLEN 0x281
|
||||
#define CMD_GET_PREVIEW 0x02
|
||||
#define CMD_GET_PREVIEW_RLEN 0x51
|
||||
#define CMD_GET_HEADER 0x80
|
||||
#define CMD_GET_HEADER_RLEN 0x21
|
||||
|
||||
#define CMD_OK 0x00
|
||||
#define CMD_IO_ERROR 0x01
|
||||
#define CMD_IO_TIMEOUT 0x02
|
||||
#define CMD_BAD_RESPONSE 0x03
|
||||
|
||||
int jd350e_remap_gp_port_error(int error)
|
||||
{
|
||||
switch(error) {
|
||||
case GP_ERROR_TIMEOUT:
|
||||
printf("Remapping GP_ERROR_TIMEOUT->CMD_IO_TIMEOUT\n");
|
||||
return CMD_IO_TIMEOUT;
|
||||
case GP_ERROR:
|
||||
printf("Remapping GP_ERROR->CMD_IO_ERROR\n");
|
||||
default:
|
||||
printf("(generic error %d actually)\n", error);
|
||||
return CMD_IO_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned char jd350e_checksum(const unsigned char *data, int start, int end)
|
||||
{
|
||||
unsigned char sum = 0;
|
||||
int i;
|
||||
|
||||
for(i = start; i <= end; ++i) {
|
||||
sum += data[i];
|
||||
sum &= 0xff;
|
||||
}
|
||||
|
||||
printf("Calculated checksum 0x%X\n", sum);
|
||||
|
||||
return sum;
|
||||
}
|
||||
|
||||
int jd350e_cmd(struct jd350e_s *device, unsigned char cmd,
|
||||
unsigned char cmd_len,
|
||||
unsigned char data1, unsigned char data2, unsigned char data3,
|
||||
unsigned char data4,
|
||||
unsigned char *response, unsigned response_len)
|
||||
{
|
||||
unsigned char packet[5];
|
||||
unsigned char rhdr;
|
||||
int ret;
|
||||
|
||||
// build command packet
|
||||
packet[0] = cmd;
|
||||
packet[1] = data1;
|
||||
packet[2] = data2;
|
||||
packet[3] = data3;
|
||||
packet[4] = data4;
|
||||
|
||||
// write to device
|
||||
printf("Writing packet to device [0x%X...]\n",cmd);
|
||||
if((ret = gp_port_write(device->gpiod, packet, cmd_len)) != GP_OK)
|
||||
return jd350e_remap_gp_port_error(ret);
|
||||
|
||||
printf("Reading Command Echo\n");
|
||||
// read response echo
|
||||
if((ret = gp_port_read(device->gpiod, &rhdr, 1)) != 1)
|
||||
return jd350e_remap_gp_port_error(ret);
|
||||
|
||||
printf("Validating Echo [0x%X]\n",rhdr);
|
||||
if( rhdr != cmd )
|
||||
return CMD_BAD_RESPONSE;
|
||||
|
||||
if( response_len == 0 )
|
||||
return CMD_OK;
|
||||
|
||||
printf("Read Response\n");
|
||||
// read response
|
||||
if((ret = gp_port_read(device->gpiod, response, response_len)) != response_len)
|
||||
return jd350e_remap_gp_port_error(ret);
|
||||
|
||||
printf("Validating Response [0x%X...0x%X]\n",
|
||||
response[0],response[response_len-1] );
|
||||
|
||||
// validate response
|
||||
if( response[response_len-1] != jd350e_checksum(response, 0, response_len-2) )
|
||||
return CMD_BAD_RESPONSE;
|
||||
|
||||
printf("Packet OK\n");
|
||||
return CMD_OK;
|
||||
}
|
||||
|
||||
int jd350e_try_cmd(struct jd350e_s *device, unsigned char cmd, unsigned char cmd_len,
|
||||
unsigned char data1, unsigned char data2, unsigned char data3,
|
||||
unsigned char data4,
|
||||
unsigned char *response, unsigned response_len,
|
||||
int retries)
|
||||
{
|
||||
int ret;
|
||||
|
||||
while(retries--) {
|
||||
printf("Trying command 0x%X\n", cmd);
|
||||
|
||||
switch(ret = jd350e_cmd(device, cmd, cmd_len, data1, data2, data3,
|
||||
data4, response, response_len)) {
|
||||
case CMD_IO_TIMEOUT:
|
||||
case CMD_BAD_RESPONSE:
|
||||
break;
|
||||
default:
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
printf("Failed command, retries exhausted\n");
|
||||
|
||||
return CMD_IO_ERROR;
|
||||
}
|
||||
|
||||
int jd350e_ping(struct jd350e_s *device)
|
||||
{
|
||||
int ret;
|
||||
printf("JD350e: pinging camera\n");
|
||||
ret = jd350e_try_cmd(device, CMD_PING,1, 0,0,0,0, 0,0, CMD_RETRIES);
|
||||
|
||||
switch(ret) {
|
||||
case CMD_IO_ERROR:
|
||||
printf("ping failed\n");
|
||||
return GP_ERROR_IO;
|
||||
case CMD_OK:
|
||||
printf("ping ok\n");
|
||||
return GP_OK;
|
||||
default:
|
||||
//Should not be reached.
|
||||
return GP_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
int jd350e_file_count(struct jd350e_s *device, int *count)
|
||||
{
|
||||
unsigned char response[CMD_GET_FILE_INFO_RLEN];
|
||||
int ret;
|
||||
|
||||
printf("JD350e: getting file count\n");
|
||||
ret = jd350e_try_cmd(device, CMD_REQUEST_DATA,2, CMD_GET_FILE_INFO,0,0,0,
|
||||
0,0, CMD_RETRIES);
|
||||
|
||||
if( ret == CMD_OK ){
|
||||
ret = jd350e_try_cmd(device, CMD_FETCH_DATA,5, 0,0,0,1,
|
||||
response, sizeof(response), CMD_RETRIES);
|
||||
}
|
||||
|
||||
sleep(2); // give the camera a chance to stop beeping
|
||||
|
||||
switch(ret) {
|
||||
case CMD_IO_ERROR:
|
||||
printf("IO error!\n");
|
||||
return GP_ERROR_IO;
|
||||
case CMD_OK:
|
||||
printf("GFI OK, count = %d\n", response[2]);
|
||||
*count = response[2];
|
||||
return GP_OK;
|
||||
default:
|
||||
//Should not be reached.
|
||||
return GP_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
int jd350e_get_image(struct jd350e_s *device, int image_no, int subcmd,
|
||||
char **data, int *size, int w, int h, int interpolate)
|
||||
{
|
||||
unsigned char set_image_no_response[CMD_SET_IMAGE_NUMBER_RLEN],
|
||||
get_header_response[CMD_GET_HEADER_RLEN];
|
||||
unsigned char *raw;
|
||||
unsigned char header[128];
|
||||
int ret;
|
||||
|
||||
ret = jd350e_try_cmd(device, CMD_SET_IMAGE_NUMBER,2, image_no,0,0,0,
|
||||
set_image_no_response, sizeof(set_image_no_response),
|
||||
CMD_RETRIES);
|
||||
|
||||
if(ret != CMD_OK) return GP_ERROR_IO;
|
||||
|
||||
ret = jd350e_try_cmd(device, CMD_REQUEST_DATA,2, CMD_GET_HEADER,0,0,0,
|
||||
0, 0, CMD_RETRIES);
|
||||
|
||||
if(ret != CMD_OK) return GP_ERROR_IO;
|
||||
|
||||
ret = jd350e_try_cmd(device, CMD_FETCH_DATA,5, 0,0,0,1,
|
||||
get_header_response, sizeof(get_header_response),
|
||||
CMD_RETRIES);
|
||||
|
||||
if(ret != CMD_OK) return GP_ERROR_IO;
|
||||
|
||||
*size = w * h;
|
||||
|
||||
printf("Image is %dx%d (%ul bytes)\n", w, h, *size);
|
||||
|
||||
raw = malloc(*size+1);
|
||||
|
||||
ret = jd350e_try_cmd(device, CMD_REQUEST_DATA,2, subcmd,0,0,0,
|
||||
0, 0, CMD_RETRIES);
|
||||
|
||||
if(ret != CMD_OK) return GP_ERROR_IO;
|
||||
|
||||
ret = jd350e_try_cmd(device, CMD_FETCH_DATA,5, 0,0,h/256,h%256,
|
||||
raw, *size+1, CMD_RETRIES);
|
||||
|
||||
if(ret != CMD_OK) return GP_ERROR_IO;
|
||||
|
||||
if( interpolate ){
|
||||
sprintf(header, "P6\n# gPhoto2 JD350e interpolated image\n%d %d\n255\n", w, h);
|
||||
}
|
||||
else{
|
||||
sprintf(header, "P5\n# gPhoto2 JD350e raw image\n%d %d\n255\n", w, h);
|
||||
}
|
||||
|
||||
*data = malloc((*size * (interpolate ? 3 : 1) ) + strlen(header));
|
||||
strcpy(*data, header);
|
||||
|
||||
if( interpolate ){
|
||||
*size *= 3;
|
||||
bayer_unshuffle(w, h, raw, *data + strlen(header));
|
||||
if(pattrec(w, h, *data + strlen(header)) != 0) {
|
||||
// fallback in low memory conditions
|
||||
bayer_demosaic(w, h, *data +strlen(header));
|
||||
}
|
||||
}
|
||||
else{
|
||||
memcpy( *data + strlen(header), raw, *size );
|
||||
}
|
||||
|
||||
free(raw);
|
||||
|
||||
*size += strlen(header);
|
||||
|
||||
return GP_OK;
|
||||
}
|
||||
|
||||
int jd350e_get_image_full(struct jd350e_s *device, int image_no,
|
||||
char **data, int *size)
|
||||
{
|
||||
image_no++;
|
||||
printf("JD350e: getting full image %d\n",image_no);
|
||||
return
|
||||
jd350e_get_image(device,image_no,CMD_GET_IMAGE,data,size,640,480,1);
|
||||
}
|
||||
|
||||
int jd350e_get_image_raw(struct jd350e_s *device, int image_no,
|
||||
char **data, int *size)
|
||||
{
|
||||
image_no++;
|
||||
printf("JD350e: getting raw image %d\n",image_no);
|
||||
return
|
||||
jd350e_get_image(device,image_no,CMD_GET_IMAGE,data,size,640,480,0);
|
||||
}
|
||||
|
||||
int jd350e_get_image_preview(struct jd350e_s *device, int image_no,
|
||||
char **data, int *size)
|
||||
{
|
||||
image_no++;
|
||||
printf("JD350e: getting preview image %d\n",image_no);
|
||||
return
|
||||
jd350e_get_image(device,image_no,CMD_GET_PREVIEW,data,size,80,60,1);
|
||||
}
|
||||
|
||||
32
camlibs/jd350e/library.h
Normal file
32
camlibs/jd350e/library.h
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Jenoptik JD350e Driver
|
||||
* Copyright (C) 2001 Michael Trawny <trawny99@yahoo.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef LIBRARY_H
|
||||
#define LIBRARY_H
|
||||
|
||||
int jd350e_ping(struct jd350e_s *device);
|
||||
int jd350e_file_count(struct jd350e_s *device, int *count);
|
||||
int jd350e_get_image_raw(struct jd350e_s *device, int image_no, char **data,
|
||||
int *size);
|
||||
int jd350e_get_image_full(struct jd350e_s *device, int image_no, char **data,
|
||||
int *size);
|
||||
int jd350e_get_image_preview(struct jd350e_s *device, int image_no,
|
||||
char **data, int *size);
|
||||
|
||||
#endif
|
||||
65
camlibs/jd350e/redcurve.h
Normal file
65
camlibs/jd350e/redcurve.h
Normal file
@@ -0,0 +1,65 @@
|
||||
unsigned red_curve [] = {
|
||||
0, 1, 2, 3,
|
||||
4, 5, 6, 8,
|
||||
9, 10, 11, 12,
|
||||
13, 15, 16, 17,
|
||||
18, 19, 20, 21,
|
||||
23, 24, 25, 25,
|
||||
26, 28, 31, 33,
|
||||
36, 39, 41, 43,
|
||||
45, 48, 50, 52,
|
||||
55, 57, 60, 62,
|
||||
64, 66, 69, 72,
|
||||
73, 75, 78, 80,
|
||||
81, 83, 86, 88,
|
||||
89, 90, 92, 97,
|
||||
98, 101, 107, 108,
|
||||
111, 114, 115, 117,
|
||||
119, 120, 121, 122,
|
||||
123, 127, 129, 133,
|
||||
132, 136, 137, 144,
|
||||
145, 147, 150, 153,
|
||||
154, 157, 158, 161,
|
||||
164, 167, 168, 170,
|
||||
172, 176, 178, 180,
|
||||
183, 184, 186, 190,
|
||||
191, 194, 193, 197,
|
||||
199, 201, 201, 207,
|
||||
206, 210, 211, 215,
|
||||
217, 219, 219, 221,
|
||||
225, 231, 231, 232,
|
||||
235, 235, 236, 242,
|
||||
243, 244, 245, 247,
|
||||
247, 250, 250, 251,
|
||||
250, 250, 250, 250,
|
||||
250, 250, 250, 250,
|
||||
250, 250, 250, 250,
|
||||
250, 250, 250, 250,
|
||||
250, 250, 250, 250,
|
||||
250, 250, 250, 250,
|
||||
250, 250, 251, 251,
|
||||
251, 251, 251, 251,
|
||||
251, 251, 251, 251,
|
||||
251, 251, 251, 251,
|
||||
251, 251, 251, 251,
|
||||
251, 251, 251, 251,
|
||||
251, 251, 251, 252,
|
||||
252, 252, 252, 252,
|
||||
252, 252, 252, 252,
|
||||
252, 252, 252, 252,
|
||||
252, 252, 252, 252,
|
||||
252, 252, 252, 252,
|
||||
252, 252, 252, 252,
|
||||
252, 253, 253, 253,
|
||||
253, 253, 253, 253,
|
||||
253, 253, 253, 253,
|
||||
253, 253, 253, 253,
|
||||
253, 253, 253, 253,
|
||||
253, 253, 253, 253,
|
||||
253, 253, 254, 254,
|
||||
254, 254, 254, 254,
|
||||
254, 254, 254, 254,
|
||||
254, 254, 254, 254,
|
||||
254, 254, 254, 254,
|
||||
254, 254, 254, 254,
|
||||
254, 254, 254, 255};
|
||||
@@ -2,7 +2,7 @@
|
||||
register interpretation
|
||||
---------------------------------------------------------------------------
|
||||
1 resolution
|
||||
2
|
||||
2 date (seconds since 1/1/1970)
|
||||
3 shutter speed
|
||||
4 current image number
|
||||
5 aperture
|
||||
@@ -26,7 +26,7 @@
|
||||
23 auto off (host)
|
||||
24 auto off (field)
|
||||
25 (s) serial number
|
||||
26
|
||||
26 (s) software revision
|
||||
27
|
||||
28 memory left
|
||||
29
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <gphoto2.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
# include <libintl.h>
|
||||
@@ -470,7 +471,7 @@ static void dump_register (Camera *camera)
|
||||
const char *description[] = {
|
||||
"?", // 0
|
||||
"resolution",
|
||||
"?",
|
||||
"date",
|
||||
"shutter speed",
|
||||
"current image number",
|
||||
"aperture",
|
||||
@@ -494,7 +495,7 @@ static void dump_register (Camera *camera)
|
||||
"auto off (host)",
|
||||
"auto off (field)",
|
||||
"serial number",
|
||||
"?",
|
||||
"software revision",
|
||||
"?",
|
||||
"memory left",
|
||||
"?",
|
||||
@@ -1134,11 +1135,15 @@ camera_summary (Camera *camera, CameraText *summary)
|
||||
/* Get all the string-related info */
|
||||
ret = sierra_get_string_register (camera, 22, 0, NULL, t, &value);
|
||||
if (ret == GP_OK)
|
||||
sprintf(buf, _("%sCamera ID : %s\n"), buf, t);
|
||||
sprintf (buf, _("%sCamera ID : %s\n"), buf, t);
|
||||
|
||||
ret = sierra_get_string_register (camera, 25, 0, NULL, t, &value);
|
||||
if (ret == GP_OK)
|
||||
sprintf(buf, _("%sSerial Number : %s\n"), buf, t);
|
||||
sprintf (buf, _("%sSerial Number : %s\n"), buf, t);
|
||||
|
||||
ret = sierra_get_string_register (camera, 26, 0, NULL, t, &value);
|
||||
if (ret == GP_OK)
|
||||
sprintf (buf, _("%sSoftware Rev. : %s\n"), buf, t);
|
||||
|
||||
/* Get all the integer information */
|
||||
if (sierra_get_int_register(camera, 10, &value) == GP_OK)
|
||||
@@ -1150,7 +1155,12 @@ camera_summary (Camera *camera, CameraText *summary)
|
||||
if (sierra_get_int_register(camera, 28, &value) == GP_OK)
|
||||
sprintf (buf, _("%sMemory Left : %i bytes\n"), buf, value);
|
||||
|
||||
strcpy(summary->text, buf);
|
||||
/* Get date */
|
||||
if (sierra_get_int_register (camera, 2, &value) == GP_OK)
|
||||
sprintf (buf, _("%sDate : %s\n"), buf,
|
||||
ctime ((time_t*) &value));
|
||||
|
||||
strcpy (summary->text, buf);
|
||||
|
||||
return (camera_stop(camera));
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ AC_SUBST(dotlibs)
|
||||
|
||||
dnl Find out which drivers to compile
|
||||
|
||||
camlibs='agfa barbie canon casio dimera directory sierra jamcam konica panasonic polaroid digita kodak minolta samsung stv0680 sonydscf1 sonydscf55'
|
||||
camlibs='agfa barbie canon casio dimera directory sierra jamcam jd350e konica panasonic polaroid digita kodak minolta samsung stv0680 sonydscf1 sonydscf55'
|
||||
AC_SUBST(SUBDIRS_CAMLIBS)
|
||||
for i in $camlibs; do
|
||||
d=`echo $i | $TR a-z A-Z`
|
||||
@@ -103,9 +103,9 @@ AC_ARG_WITH(drivers,
|
||||
[ 'all' compiles all drivers; ]
|
||||
[ possible drivers are: ]
|
||||
[ agfa, barbie, canon, casio, digita, dimera,]
|
||||
[ directory, jamcam, kodak, konica, minolta,]
|
||||
[ panasonic, polaroid, samsung, sierra, sonydscf1,]
|
||||
[ sonydscf55, stv0680 ],
|
||||
[ directory, jamcam, jd350e, kodak, konica,]
|
||||
[ minolta, panasonic, polaroid, samsung, sierra,]
|
||||
[ sonydscf1, sonydscf55, stv0680 ],
|
||||
drivers="$withval", drivers="all")
|
||||
if test "$drivers" = "all"; then
|
||||
for i in $camlibs; do
|
||||
@@ -172,6 +172,7 @@ camlibs/digita/Makefile
|
||||
camlibs/dimera/Makefile
|
||||
camlibs/directory/Makefile
|
||||
camlibs/jamcam/Makefile
|
||||
camlibs/jd350e/Makefile
|
||||
camlibs/kodak/Makefile
|
||||
camlibs/kodak/dc120/Makefile
|
||||
camlibs/kodak/dc240/Makefile
|
||||
|
||||
Reference in New Issue
Block a user