Matto Marjanovic wrote: > > >> I verified Your latest (second) patch. It also works without any > >> problems, e.a. compiles, scans and picture looks fine. > ... > >thanks for this report. To be honest, i must admit that I can't really > >remember your first mails :( But it's nice to read that the patch fixes > >more bugs than expected :) > > Likewise, I lost track of some of this thread. (But it's nice to see > that I'm not immediately on the hook to fix anything anymore.) > > What does the patch do? (And how did it fix up the Microtek scanning?)
Don't ask for too specific details ;) The main point is, that the sense handler is no longer called for every error status returned by FreeBSD's CAM system. Instead, sanei_scsi_cmd2 now returns either SANE_STATUS_GOOD, SANE_STATUS_IO_ERROR, or SANE_STATUS_DEVICE_BUSY, depending on the status returned by the OS. The sense handler is only called, if ccb->ccb_h.status & CAM_AUTOSNS_VALID is true, which should guarantee that useful sense data is available. Several attempts to send a command to the scanner time out (the first one is the "stop scan" command), where "time out" means that the host could not send the command to the scanner within a certain time (for Linux, this is ~0.5 seconds). This time out is different from the "command time out" value, which is the time the host waits until a device finishes a SCSI command. Without the patch, the sense handler of backend is called for every failing command, but because no sense data is available, the sense handler decides to return SANE_STATUS_GOOD, hence the backend makes wrong assuptions about the status of the scanner. What I don't really understand in hindsight is the CAM status value 16 in Martin's log data. It indicates that the FreeBSD CAM system tried to issue a REQUEST SENSE for one or another failing command (where "failing" means in this case that the scanner accepted the command, and returned CHECK CONDITION), and that the REQUEST SENSE was not successful. Another point: I would really appreciate if more people could test the patch -- I have some hope that it is not too buggy in itself, but not being able to test it for myself (well, ok -- I'm too lazy or too busy to install FreeBSD -- chose whatever you want...), I'm hesitating to commit it to the CVS server. Abel
