Hi, Carl.
Carl Baltser Pedersen wrote:
> Using the hpo to scan, hpo scan bw, it always ended in a segmentation fault
> which annoyed me.
"hpo scan" is mainly test code and isn't terribly useful for scanning.
> Using gdb, I traced the problem to PMLClose() in pml.c.
>
> After the PMLUnregisterTrap(), the traps pointer might be NULL because the
> trap might have been free'd.
>
> Adding a test after PMLProcess((), no more segmentation faults appears.
>
> void PMLClose(void)
> {
> static trap_t *curtrap;
>
> /* Unregister all traps */
> while(traps != NULL)
> {
> PMLUnregisterTrap(traps->oid);
> PMLProcess();
>
> if( traps == NULL ) <--- Added
> break; <--- Added.
> curtrap = traps;
> traps = traps->next;
> free(curtrap);
> }
>
> free(rcv_buf);
> MlcCon_close(connection);
> delete_MlcCon(connection);
> }
From a quick look of the code I'm not sure this is really the problem.
"traps" is essentially the head pointer in a linked list, and the while
loop stops as soon as it reaches the end of the list. I couldn't find
any other place where items in the list were freed, but perhaps I missed
something. But if it works for you, then great. Am I correct in assuming
that this problem only shows up for you when running "hpo scan"? In that
case I don't think I will worry about it, because I am in the process of
replacing ojlib with PTAL, once I finish adding PML support to PTAL.
> Now is the problem to figure out how to use the scanned data.
> The 590 is not supported by the current SANE interface(ptal-connect) as far
> as I can figure out.
For now that's true, but I plan to fix that eventually. Lately I've been
concentrating on lower-level I/O issues, which I think will need to be
resolved before scanning will work reliably on this class of OfficeJets
anyway.
> Haven't tried the printing yet as one of the std. HP deskjet drivers
> usually works.
For now that may be your best bet, but keep an eye out for updates of this
project.
David
|