memset(buf, 0, bufsize);
*bytes_read = 0;
+#ifdef YK_DEBUG
+ fprintf(stderr, "YK_DEBUG: Read %i bytes from YubiKey :\n", expect_bytes);
+#endif
/* Wait for the key to turn on RESP_PENDING_FLAG */
if (! yk_wait_for_key_status(yk, slot, flags, 1000, true, RESP_PENDING_FLAG, (char *) &data))
return 0;
if (!_ykusb_read(yk, REPORT_TYPE_FEATURE, 0, (char *)data, FEATURE_RPT_SIZE))
return 0;
-
+#ifdef YK_DEBUG
+ _yk_hexdump(data, FEATURE_RPT_SIZE);
+#endif
if (data[FEATURE_RPT_SIZE - 1] & RESP_PENDING_FLAG) {
/* The lower five bits of the status byte has the response sequence
* number. If that gets reset to zero we are done.
if (! yk_wait_for_key_status(yk, slot, 0, 1000, false, SLOT_WRITE_FLAG, NULL))
return 0;
*/
+#ifdef YK_DEBUG
+ fprintf(stderr, "YK_DEBUG: Write %i bytes to YubiKey :\n", bufcount);
+#endif
for (seq = 0; ptr < end; seq++) {
int all_zeros = 1;
/* Ignore parts that are all zeroes except first and last
if (! yk_wait_for_key_status(yk, slot, 0, WAIT_FOR_WRITE_FLAG,
false, SLOT_WRITE_FLAG, NULL))
return 0;
-
+#ifdef YK_DEBUG
+ _yk_hexdump(repbuf, FEATURE_RPT_SIZE);
+#endif
if (!_ykusb_write(yk, REPORT_TYPE_FEATURE, 0,
(char *)repbuf, FEATURE_RPT_SIZE))
return 0;