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 | 8 | *.mod.c |
| 9 | 9 | *.o.cmd |
| 10 | 10 | *.ko.cmd |
| 11 | +*.mod.cmd | |
| 12 | +*.mod | |
| 11 | 13 | /module/Module.symvers |
| 12 | 14 | /module/modules.order |
| 13 | 15 | /module/.tmp_versions |
| ... | ... | @@ -23,3 +25,16 @@ pts/tty0tty |
| 23 | 25 | .settings |
| 24 | 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 | 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 | 263 | struct tty0tty_serial *tty0tty = tty->driver_data; |
| 264 | 264 | int room = 0; |
| ... | ... | @@ -628,7 +628,7 @@ static int __init tty0tty_init(void) |
| 628 | 628 | printk(KERN_DEBUG "%s - \n", __FUNCTION__); |
| 629 | 629 | #endif |
| 630 | 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 | 632 | if (!tty0tty_tty_driver) |
| 633 | 633 | return -ENOMEM; |
| 634 | 634 | |
| ... | ... | @@ -664,7 +664,7 @@ static int __init tty0tty_init(void) |
| 664 | 664 | retval = tty_register_driver(tty0tty_tty_driver); |
| 665 | 665 | if (retval) { |
| 666 | 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 | 668 | return retval; |
| 669 | 669 | } |
| 670 | 670 | ... | ... |