Commit 6ddc329c authored by Andrey Filippov's avatar Andrey Filippov

fixed another exif bug, generated goot tiff

parent 53ba16e9
...@@ -804,6 +804,7 @@ ssize_t exif_read (struct file * file, char * buf, size_t count, loff_t *of ...@@ -804,6 +804,7 @@ ssize_t exif_read (struct file * file, char * buf, size_t count, loff_t *of
int sensor_port; int sensor_port;
char tmp[MAX_EXIF_SIZE]; //! Or is it possible to disable IRQ while copy_from_user()? char tmp[MAX_EXIF_SIZE]; //! Or is it possible to disable IRQ while copy_from_user()?
int is_tiff = 0; int is_tiff = 0;
int template_size;
/* /*
Does not work with PHP - always read 8192 bytes Does not work with PHP - always read 8192 bytes
if ((*off+count)>maxsize) { if ((*off+count)>maxsize) {
...@@ -851,27 +852,29 @@ ssize_t exif_read (struct file * file, char * buf, size_t count, loff_t *of ...@@ -851,27 +852,29 @@ ssize_t exif_read (struct file * file, char * buf, size_t count, loff_t *of
case DEV393_MINOR(DEV393_EXIF1): case DEV393_MINOR(DEV393_EXIF1):
case DEV393_MINOR(DEV393_EXIF2): case DEV393_MINOR(DEV393_EXIF2):
case DEV393_MINOR(DEV393_EXIF3): case DEV393_MINOR(DEV393_EXIF3):
sensor_port = (p - ((is_tiff)?DEV393_MINOR(DEV393_TIFF0):DEV393_MINOR(DEV393_EXIF0))) & 3; // &3 just to make compiler happy sensor_port = (p - (is_tiff ? DEV393_MINOR(DEV393_TIFF0):DEV393_MINOR(DEV393_EXIF0))) & 3; // &3 just to make compiler happy
//will truncate by the end of current page //will truncate by the end of current page
if (!aexif_enabled[sensor_port]) return 0; if (!aexif_enabled[sensor_port]) return 0;
i=((int) *off) / exif_template_size; template_size = is_tiff ? tiff_template_size: exif_template_size;
dev_dbg(g_devfp_ptr,"count= 0x%x, *off= 0x%x, i=0x%x, exif_template_size=0x%x\n", (int) count, (int) *off, (int) i, (int) exif_template_size);
//arch/cris/arch-v32/drivers/elphel/exif353.c:590:count= 0x2000, *off= 0x410, i=0x82, exif_template_size=0x208 i=((int) *off) / template_size;
start_p=i*exif_template_size; dev_dbg(g_devfp_ptr,"count= 0x%x, *off= 0x%x, i=0x%x, template_size=0x%x\n", (int) count, (int) *off, (int) i, (int) template_size);
//arch/cris/arch-v32/drivers/elphel/exif353.c:590:count= 0x2000, *off= 0x410, i=0x82, template_size=0x208
start_p=i*template_size;
page_p= *off - start_p; page_p= *off - start_p;
dev_dbg(g_devfp_ptr,"count= 0x%x, pos= 0x%x, start_p=0x%x, page_p=0x%x, i=0x%x, exif_template_size=0x%x\n", (int) count, (int) *off, (int)start_p, (int)page_p,(int) i, (int) exif_template_size); dev_dbg(g_devfp_ptr,"count= 0x%x, pos= 0x%x, start_p=0x%x, page_p=0x%x, i=0x%x, template_size=0x%x\n", (int) count, (int) *off, (int)start_p, (int)page_p,(int) i, (int) template_size);
//arch/cris/arch-v32/drivers/elphel/exif353.c:591:count= 0x2000, pos= 0x410, start_p=0x10810, page_p=0xfffefc00, i=0x82, exif_template_size=0x208 //arch/cris/arch-v32/drivers/elphel/exif353.c:591:count= 0x2000, pos= 0x410, start_p=0x10810, page_p=0xfffefc00, i=0x82, template_size=0x208
metap= &ameta_buffer[sensor_port][i*aexif_meta_size[sensor_port]]; // pointer to the start of the selected page in frame meta_buffer metap= &ameta_buffer[sensor_port][i*aexif_meta_size[sensor_port]]; // pointer to the start of the selected page in frame meta_buffer
if ((page_p+count) > exif_template_size) count=exif_template_size-page_p; if ((page_p+count) > template_size) count=template_size-page_p;
// memcpy(tmp,exif_template, exif_template_size); // memcpy(tmp,exif_template, template_size);
// dev_dbg(g_devfp_ptr,"count= 0x%x, pos= 0x%x, start_p=0x%x, page_p=0x%x\n", (int) count, (int) *off, (int)start_p, (int)page_p); // dev_dbg(g_devfp_ptr,"count= 0x%x, pos= 0x%x, start_p=0x%x, page_p=0x%x\n", (int) count, (int) *off, (int)start_p, (int)page_p);
if (is_tiff) { if (is_tiff) {
memcpy(tmp,tiff_template, tiff_template_size); memcpy(tmp,tiff_template, template_size);
for (i=0;i<exif_fields;i++) { for (i=0;i<exif_fields;i++) {
if (dir_table[i].dst_tiff > 0) memcpy(&tmp[dir_table[i].dst_tiff],&metap[dir_table[i].src], dir_table[i].len); if (dir_table[i].dst_tiff > 0) memcpy(&tmp[dir_table[i].dst_tiff],&metap[dir_table[i].src], dir_table[i].len);
} }
} else { } else {
memcpy(tmp,exif_template, exif_template_size); memcpy(tmp,exif_template, template_size);
for (i=0;i<exif_fields;i++) { for (i=0;i<exif_fields;i++) {
if (dir_table[i].dst_exif > 0) memcpy(&tmp[dir_table[i].dst_exif],&metap[dir_table[i].src], dir_table[i].len); if (dir_table[i].dst_exif > 0) memcpy(&tmp[dir_table[i].dst_exif],&metap[dir_table[i].src], dir_table[i].len);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment