struct cc_hex_read hex_buf[CC_NUM_HEX_READ];
int hex_count;
+
+ int remote;
};
#define NOT_HEX 0xff
return 1;
}
+void
+cc_usb_open_remote(struct cc_usb *cc, int channel)
+{
+ if (!cc->remote) {
+ printf ("channel %d\n", channel);
+ cc_usb_printf(cc, "\nc r %d\np\nE 0\n", channel);
+ do {
+ cc->in_count = cc->in_pos = 0;
+ _cc_usb_sync(cc, 100);
+ } while (cc->in_count > 0);
+ cc->remote = 1;
+ }
+}
+
+void
+cc_usb_close_remote(struct cc_usb *cc)
+{
+ if (cc->remote) {
+ cc_usb_printf(cc, "~");
+ cc->remote = 0;
+ }
+}
+
static struct termios save_termios;
struct cc_usb *
save_termios = termios;
cfmakeraw(&termios);
tcsetattr(cc->fd, TCSAFLUSH, &termios);
- cc_usb_printf(cc, "E 0\nm 0\n");
+ cc_usb_printf(cc, "\nE 0\nm 0\n");
do {
cc->in_count = cc->in_pos = 0;
_cc_usb_sync(cc, 100);
void
cc_usb_close(struct cc_usb *cc)
{
+ cc_usb_close_remote(cc);
+ cc_usb_sync(cc);
tcsetattr(cc->fd, TCSAFLUSH, &save_termios);
close (cc->fd);
free (cc);