JNIEXPORT void JNICALL Java_io_card_payment_CardScanner_nSetup(JNIEnv *env, jobject thiz, jboolean shouldOnlyDetectCard, jfloat jMinFocusScore) { dmz_debug_log("Java_io_card_payment_CardScanner_nSetup"); dmz_trace_log("dmz trace enabled"); detectOnly = shouldOnlyDetectCard; minFocusScore = jMinFocusScore; flipped = false; lastFrameWasUsable = false; if (dmz == NULL) { dmz = dmz_context_create(); scanner_initialize(&scannerState); } else { scanner_reset(&scannerState); } dmz_refcount++; cvSetErrMode(CV_ErrModeParent); }
JNIEXPORT void JNICALL Java_io_card_payment_CardScanner_nResetAnalytics(JNIEnv *env, jobject thiz) { scanner_reset(&scannerState); }
int sanei_canon_pp_wake_scanner(struct parport *port, int mode) { /* The scanner tristates the printer's control lines (essentially disabling the passthrough port) and exits from Transparent Mode ready for communication. */ int i = 0; int tmp; int max_cycles = 3; tmp = readstatus(port); /* Reset only works on 30/40 models */ if (mode != INITMODE_20P) { if ((tmp != READY)) { DBG(40, "Scanner not ready (0x%x). Attempting to " "reset...\n", tmp); scanner_reset(port); /* give it more of a chance to reset in this case */ max_cycles = 5; } } else { DBG(0, "WARNING: Don't know how to reset an FBx20P, you may " "have to power cycle\n"); } do { i++; /* Send the wakeup sequence */ scanner_chessboard_control(port); scanner_chessboard_data(port, mode); if (expect(port, NULL, 0x03, 0x1f, 800000) && (mode == INITMODE_AUTO)) { /* 630 Style init failed, try 620 style */ scanner_chessboard_control(port); scanner_chessboard_data(port, INITMODE_20P); } if (expect(port, "Scanner wakeup reply 1", 0x03, 0x1f, 50000)) { outboth(port, 0x04, 0x0d); usleep(100000); outcont(port, 0x07, 0x0f); usleep(100000); } } while ((i < max_cycles) && (!expect(port,"Scanner wakeup reply 2", 0x03, 0x1f, 100000) == 0)); /* Block just after chessboarding Reply 1 (S3 and S4 on, S5 and S7 off) */ outcont(port, 0, HOSTBUSY); /* C1 off */ /* Reply 2 - If it ain't happening by now, it ain't gonna happen. */ if (expect(port, "Reply 2", 0xc, 0x1f, 800000)) return -1; outcont(port, HOSTBUSY, HOSTBUSY); /* C1 on */ if (expect(port, "Reply 3", 0x0b, 0x1f, 800000)) return -1; outboth(port, 0, NSELECTIN | NINIT | HOSTCLK); /* Clear D, C3+, C1- */ /* If we had to try the wakeup cycle more than once, we should wait * here for 10 seconds to let the scanner pull itself together - * it can actually take longer, but I can't wait that long! */ if (i > 1) { DBG(10, "Had to reset scanner, waiting for the " "head to get back.\n"); usleep(10000000); } return 0; }