Commit 78661fa88449a648a1088b563fdcbc5b2ddfca0f
Committed by
GitHub
Merge branch 'master' into no_error
Showing
4 changed files
with
39 additions
and
3 deletions
.gitignore
| @@ -8,6 +8,8 @@ | @@ -8,6 +8,8 @@ | ||
| 8 | *.mod.c | 8 | *.mod.c |
| 9 | *.o.cmd | 9 | *.o.cmd |
| 10 | *.ko.cmd | 10 | *.ko.cmd |
| 11 | +*.mod.cmd | ||
| 12 | +*.mod | ||
| 11 | /module/Module.symvers | 13 | /module/Module.symvers |
| 12 | /module/modules.order | 14 | /module/modules.order |
| 13 | /module/.tmp_versions | 15 | /module/.tmp_versions |
| @@ -23,3 +25,16 @@ pts/tty0tty | @@ -23,3 +25,16 @@ pts/tty0tty | ||
| 23 | .settings | 25 | .settings |
| 24 | .pydevproject | 26 | .pydevproject |
| 25 | 27 | ||
| 28 | +# debian packaging artifacts | ||
| 29 | +debian/* | ||
| 30 | +debhelper/* | ||
| 31 | +files | ||
| 32 | +*-dkms.debhelper.log | ||
| 33 | +*-dkms.dkms.debhelper | ||
| 34 | +*-dkms.postinst.debhelper | ||
| 35 | +*-dkms.prerm.debhelper | ||
| 36 | +*-dkms.substvars | ||
| 37 | +*-dkms/* | ||
| 38 | + | ||
| 39 | +# vim temporary file | ||
| 40 | +*.swp |
examples/tnt1_echo_tnt0.py
0 → 100644
| 1 | +import serial | ||
| 2 | + | ||
| 3 | +serialPort_tnt0 = serial.Serial(port = "/dev/tnt0", baudrate=115200, | ||
| 4 | + bytesize=8, timeout=2, stopbits=serial.STOPBITS_ONE) | ||
| 5 | +serialPort_tnt1 = serial.Serial(port = "/dev/tnt1", baudrate=115200, | ||
| 6 | + bytesize=8, timeout=2, stopbits=serial.STOPBITS_ONE) | ||
| 7 | +serialPort_tnt0.write(b"hello there \r\n") | ||
| 8 | + | ||
| 9 | +while(1): | ||
| 10 | + # Wait until there is data waiting in the serial buffer | ||
| 11 | + if(serialPort_tnt1.in_waiting > 0): | ||
| 12 | + # Read data out of the buffer until a carraige return / new line is found | ||
| 13 | + serialString = serialPort_tnt1.readline() | ||
| 14 | + # Print the contents of the serial data | ||
| 15 | + print(serialString.decode('Ascii')) | ||
| 16 | + # exit | ||
| 17 | + break |
module/tty0tty.c
| @@ -258,7 +258,7 @@ exit: | @@ -258,7 +258,7 @@ exit: | ||
| 258 | return retval; | 258 | return retval; |
| 259 | } | 259 | } |
| 260 | 260 | ||
| 261 | -static int tty0tty_write_room(struct tty_struct *tty) | 261 | +static unsigned int tty0tty_write_room(struct tty_struct *tty) |
| 262 | { | 262 | { |
| 263 | struct tty0tty_serial *tty0tty = tty->driver_data; | 263 | struct tty0tty_serial *tty0tty = tty->driver_data; |
| 264 | int room = 0; | 264 | int room = 0; |
| @@ -628,7 +628,7 @@ static int __init tty0tty_init(void) | @@ -628,7 +628,7 @@ static int __init tty0tty_init(void) | ||
| 628 | printk(KERN_DEBUG "%s - \n", __FUNCTION__); | 628 | printk(KERN_DEBUG "%s - \n", __FUNCTION__); |
| 629 | #endif | 629 | #endif |
| 630 | /* allocate the tty driver */ | 630 | /* allocate the tty driver */ |
| 631 | - tty0tty_tty_driver = alloc_tty_driver(2 * pairs); | 631 | + tty0tty_tty_driver = tty_alloc_driver(2 * pairs, 0); |
| 632 | if (!tty0tty_tty_driver) | 632 | if (!tty0tty_tty_driver) |
| 633 | return -ENOMEM; | 633 | return -ENOMEM; |
| 634 | 634 | ||
| @@ -664,7 +664,7 @@ static int __init tty0tty_init(void) | @@ -664,7 +664,7 @@ static int __init tty0tty_init(void) | ||
| 664 | retval = tty_register_driver(tty0tty_tty_driver); | 664 | retval = tty_register_driver(tty0tty_tty_driver); |
| 665 | if (retval) { | 665 | if (retval) { |
| 666 | printk(KERN_ERR "failed to register tty0tty tty driver"); | 666 | printk(KERN_ERR "failed to register tty0tty tty driver"); |
| 667 | - put_tty_driver(tty0tty_tty_driver); | 667 | + tty_driver_kref_put(tty0tty_tty_driver); |
| 668 | return retval; | 668 | return retval; |
| 669 | } | 669 | } |
| 670 | 670 |
pts/tty0tty.c
| @@ -32,7 +32,11 @@ | @@ -32,7 +32,11 @@ | ||
| 32 | #include <sys/select.h> | 32 | #include <sys/select.h> |
| 33 | #include <errno.h> | 33 | #include <errno.h> |
| 34 | 34 | ||
| 35 | +#ifdef __APPLE__ | ||
| 36 | +#include <term.h> | ||
| 37 | +#else | ||
| 35 | #include <termio.h> | 38 | #include <termio.h> |
| 39 | +#endif | ||
| 36 | 40 | ||
| 37 | static char buffer[1024]; | 41 | static char buffer[1024]; |
| 38 | 42 |