+struct jtagkey_reader_arg {
+ int num;
+ unsigned char *buf;
+};
+
+static void *jtagkey_reader(void *thread_arg) {
+ struct jtagkey_reader_arg *arg = (struct jtagkey_reader_arg*)thread_arg;
+
+ int i;
+
+ i = 0;
+ DPRINTF("reader for %d bytes\n", arg->num);
+ while (i < arg->num) {
+ i += ftdi_read_data(&ftdic, arg->buf + i, arg->num - i);
+ }
+
+ pthread_exit(NULL);
+}
+
+/* TODO: Interpret JTAG commands and transfer in MPSSE mode */