static void workaround_first_command (pixma_t * s) { /* FIXME: Send a dummy command because the device doesn't response to the first command that is sent directly after the USB interface has been set up. Why? USB isn't set up properly? */ uint8_t cmd[10]; int error; if (s->cfg->pid == MP750_PID) return; /* MP750 doesn't have this problem(?) */ PDBG (pixma_dbg (1, "Work-around for the problem: device doesn't response to the first command.\n")); memset (cmd, 0, sizeof (cmd)); pixma_set_be16 (cmd_calibrate, cmd); error = pixma_write (s->io, cmd, 10); if (error != 10) { if (error < 0) { PDBG (pixma_dbg (1, " Sending a dummy command failed: %s\n", pixma_strerror (error))); } else { PDBG (pixma_dbg (1, " Sending a dummy command failed: count = %d\n", error)); } return; } error = pixma_read (s->io, cmd, sizeof (cmd)); if (error >= 0) { PDBG (pixma_dbg (1, " Got %d bytes response from a dummy command.\n", error)); } else { PDBG (pixma_dbg (1, " Reading response of a dummy command failed: %s\n", pixma_strerror (error))); } }
static void mp730_finish_scan (pixma_t * s) { int error, aborted = 0; mp730_t *mp = (mp730_t *) s->subdriver; switch (mp->state) { case state_transfering: drain_bulk_in (s); /* fall through */ case state_scanning: case state_warmup: aborted = 1; error = abort_session (s); if (error < 0) PDBG (pixma_dbg (1, "WARNING:abort_session() failed %s\n", pixma_strerror (error))); /* fall through */ case state_finished: query_status (s); query_status (s); activate (s, 0); if (! aborted && s->cfg->pid == IR1020_PID) { error = abort_session (s); if (error < 0) { PDBG (pixma_dbg (1, "WARNING:abort_session() failed %s\n", pixma_strerror (error))); query_status (s); query_status (s); activate (s, 0); } } mp->buf = mp->lbuf = mp->imgbuf = NULL; mp->state = state_idle; /* fall through */ case state_idle: break; } }
static void iclass_finish_scan (pixma_t * s) { int error; iclass_t *mf = (iclass_t *) s->subdriver; switch (mf->state) { /* fall through */ case state_warmup: case state_scanning: error = abort_session (s); if (error < 0) PDBG (pixma_dbg (1, "WARNING:abort_session() failed %s\n", pixma_strerror (error))); /* fall through */ case state_finished: query_status (s); query_status (s); if (mf->generation == 1) { /* activate only seen for generation 1 scanners */ activate (s, 0); query_status (s); } /* 0x38 = last block and ADF empty * 0x28 = last block and Paper in ADF */ if (mf->last_block==0x38 /* ADF empty */ || (mf->generation == 1 && mf->last_block == 0x28)) /* generation 1 scanner or Paper in ADF */ { PDBG (pixma_dbg (3, "*iclass_finish_scan***** abort session *****\n")); abort_session (s); } else PDBG (pixma_dbg (3, "*iclass_finish_scan***** wait for next page from ADF *****\n")); mf->state = state_idle; /* fall through */ case state_idle: break; } }