Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 02 Oct 2013 08:25:30 +0200
From:      Hans Petter Selasky <hps@bitfrost.no>
To:        John <freebsd-lists@potato.growveg.org>
Cc:        freebsd-current@freebsd.org
Subject:   Re: gphoto2 bus error
Message-ID:  <524BBC5A.6060108@bitfrost.no>
In-Reply-To: <20131001135021.GA56944@potato.growveg.org>
References:  <20131001135021.GA56944@potato.growveg.org>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------030305040700030006020803
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

On 10/01/13 15:50, John wrote:
> sorry, forgot to change "From:", sending again
>
> On Tue, Oct 01, 2013 at 02:45:29PM +0100, John wrote:
>> On Tue, Oct 01, 2013 at 02:41:22PM +0200, Hans Petter Selasky wrote:
>>>
>>> Hi,
>>>
>>> Could you enter "bt" in GDB and show the output when this crash happens?
>>>
>>> --HPS
>>
>> Sure! Thanks for looking at the problem.
>>
>> Program received signal SIGBUS, Bus error.
>> [Switching to Thread 802c07400 (LWP 101021/scanimage)]
>> 0x00000008063c1829 in scsi_inquiry ()
>>     from /usr/local/lib/sane/libsane-microtek2.so.1
>> (gdb) bt
>> #0  0x00000008063c1829 in scsi_inquiry ()
>>     from /usr/local/lib/sane/libsane-microtek2.so.1
>> #1  0x00000008063b384c in attach ()
>>     from /usr/local/lib/sane/libsane-microtek2.so.1
>> #2  0x00000008063b4a69 in attach_one ()
>>     from /usr/local/lib/sane/libsane-microtek2.so.1
>> #3  0x000000080083205b in sanei_scsi_find_devices ()
>>     from /usr/local/lib/libsane.so.1
>> #4  0x000000080082ef1e in sanei_config_attach_matching_devices ()
>>     from /usr/local/lib/libsane.so.1
>> #5  0x00000008063b4993 in sane_microtek2_init ()
>>     from /usr/local/lib/sane/libsane-microtek2.so.1
>> #6  0x000000080083acb4 in init () from /usr/local/lib/libsane.so.1
>> #7  0x000000080083a944 in sane_dll_get_devices ()
>>     from /usr/local/lib/libsane.so.1
>> #8  0x0000000000402089 in ?? ()
>> #9  0x0000000000401c41 in ?? ()
>> #10 0x0000000800628000 in ?? ()
>> #11 0x0000000000000000 in ?? ()
>> (gdb)
>>
>> --
>> John
>

Hi,

Can you try to apply the attached patch to:

cd /usr/ports/graphics/sane-backends

make clean extract patch

cd /usr/ports/graphics/sane-backends/work/sane-backends-1.0.23

cat sane-backend-debug.diff | patch -p1

cd /usr/ports/graphics/sane-backends

make all deinstall install

Maybe you can figure out exactly what line is causing the crash by 
adding more printf's like shown in the attached patch.

--HPS

--------------030305040700030006020803
Content-Type: text/x-patch;
 name="sane-backend-debug.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="sane-backend-debug.diff"

diff --git a/backend/microtek2.c b/backend/microtek2.c
index d56e568..1aafa80 100644
--- a/backend/microtek2.c
+++ b/backend/microtek2.c
@@ -4276,6 +4276,8 @@ scsi_send_gamma(Microtek2_Scanner *ms)
 
 /*---------- scsi_inquiry() --------------------------------------------------*/
 
+#include <stdio.h>
+
 static SANE_Status
 scsi_inquiry(Microtek2_Info *mi, char *device)
 {
@@ -4286,6 +4288,7 @@ scsi_inquiry(Microtek2_Info *mi, char *device)
     size_t size;
     int sfd;
 
+    printf("A %p %s\n", mi, device);
 
     DBG(30, "scsi_inquiry: mi=%p, device='%s'\n", (void *) mi, device);
 
@@ -4296,6 +4299,8 @@ scsi_inquiry(Microtek2_Info *mi, char *device)
         return status;
       }
 
+    printf("B\n");
+
     INQ_CMD(cmd);
     INQ_SET_ALLOC(cmd, INQ_ALLOC_L);
     result = (uint8_t *) alloca(INQ_ALLOC_L);
@@ -4306,6 +4311,8 @@ scsi_inquiry(Microtek2_Info *mi, char *device)
         return SANE_STATUS_NO_MEM;
       }
 
+    printf("C\n");
+
     size = INQ_ALLOC_L;
     status = sanei_scsi_cmd(sfd, cmd, sizeof(cmd), result, &size);
     if ( status != SANE_STATUS_GOOD )
@@ -4315,6 +4322,8 @@ scsi_inquiry(Microtek2_Info *mi, char *device)
         return status;
       }
 
+    printf("D\n");
+
     INQ_GET_INQLEN(inqlen, result);
     INQ_SET_ALLOC(cmd, inqlen + INQ_ALLOC_L);
     result = alloca(inqlen + INQ_ALLOC_L);
@@ -4328,6 +4337,8 @@ scsi_inquiry(Microtek2_Info *mi, char *device)
     if (md_dump >= 2 )
         dump_area2(cmd, sizeof(cmd), "inquiry");
 
+    printf("E\n");
+
     status = sanei_scsi_cmd(sfd, cmd, sizeof(cmd), result, &size);
     if ( status != SANE_STATUS_GOOD )
       {
@@ -4337,12 +4348,16 @@ scsi_inquiry(Microtek2_Info *mi, char *device)
       }
     sanei_scsi_close(sfd);
 
+    printf("F\n");
+
     if (md_dump >= 2 )
       {
         dump_area2((uint8_t *) result, size, "inquiryresult");
         dump_area((uint8_t *) result, size, "inquiryresult");
       }
 
+    printf("G\n");
+
     /* copy results */
     INQ_GET_QUAL(mi->device_qualifier, result);
     INQ_GET_DEVT(mi->device_type, result);
@@ -4352,6 +4367,7 @@ scsi_inquiry(Microtek2_Info *mi, char *device)
     INQ_GET_REV(mi->revision, (char *)result);
     INQ_GET_MODELCODE(mi->model_code, result);
 
+    printf("H\n");
 
     return SANE_STATUS_GOOD;
 }

--------------030305040700030006020803--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?524BBC5A.6060108>