Skip to content

Instantly share code, notes, and snippets.

@rvalles
Created October 11, 2020 09:25
Show Gist options
  • Save rvalles/f937889712d24ac6824f1358c936b3e2 to your computer and use it in GitHub Desktop.
Save rvalles/f937889712d24ac6824f1358c936b3e2 to your computer and use it in GitHub Desktop.
Make libticables2 work (on linux) with dbus-behind-uart-on-ttyUSB bridges like dbus_ti_link_uart_verilog. Change baudrate to 115200. Enable RTS/CTS flow control.
diff --unified --text libticables2-1.3.5/src/linux/detect.c libticables2-1.3.5-fpga/src/linux/detect.c
--- libticables2-1.3.5/src/linux/detect.c 2016-04-04 14:59:39.000000000 +0900
+++ libticables2-1.3.5-fpga/src/linux/detect.c 2020-10-09 16:38:56.564237490 +0900
@@ -331,7 +331,7 @@
}
serinfo.reserved_char[0] = 0;
- if (ioctl(fd, TIOCGSERIAL, &serinfo) < 0)
+ /*if (ioctl(fd, TIOCGSERIAL, &serinfo) < 0)
{
ticables_warning(_("Error running TIOCGSERIAL ioctl on device %s - %s"), devname, strerror(errno));
close(fd);
@@ -343,7 +343,7 @@
ticables_info(_(" is useable: no"));
close(fd);
return ERR_TTDEV;
- }
+ }*/
ticables_info(_(" is useable: yes"));
close(fd);
diff --unified --text libticables2-1.3.5/src/linux/link_gry.c libticables2-1.3.5-fpga/src/linux/link_gry.c
--- libticables2-1.3.5/src/linux/link_gry.c 2016-04-04 14:59:39.000000000 +0900
+++ libticables2-1.3.5-fpga/src/linux/link_gry.c 2020-10-11 10:03:46.620969558 +0900
@@ -55,7 +55,7 @@
#define DEVNAME "cuad"
#endif
#else
-#define DEVNAME "ttyS"
+#define DEVNAME "ttyUSB"
#endif
static int gry_prepare(CableHandle *h)
@@ -135,8 +135,9 @@
termset->c_cc[VMIN] = 0;
termset->c_cc[VTIME] = h->timeout;
- cfsetispeed(termset, B9600);
- cfsetospeed(termset, B9600);
+ termset->c_cflag |= CRTSCTS;
+ cfsetispeed(termset, B115200);
+ cfsetospeed(termset, B115200);
tcsetattr(dev_fd, TCSANOW, termset);
if (tcflush(dev_fd, TCIOFLUSH) == -1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment