Closed pieterverberne closed 1 year ago
On Fri, Jun 02, 2023 at 03:06:53AM -0700, pieterverberne wrote:
I'm trying to use gensio to transfer a file over xmodem:
gensiot --server -i 'serialdev,/dev/ttyUSB0,115200n81,local' -a 'telnet(rfc2217),5000'
(I also tried 'telnet' and 'tcp')
Next I use pyserial or sx to start the file transfer:
Example: https://pypi.org/project/xmodem/
sx -vv -X -b --tcp-client localhost:5000 <file>
In both cases I get "NAK on sector". Direct xmodem transfers (screen + sx) work fine. It is (or should it be) possible use xmodem via gensio?
It should be possible, however, telnet is not going to work. You need to use tcp. The other issue is that you have no flow-control on the serial port. I don't know what's on the other end, but if it can't keep up, you will overrun the serial device and drop data. You can try adding the rtscts option to the serial port and see if that helps.
-corey
Thanks!
-- Reply to this email directly or view it on GitHub: https://github.com/cminyard/gensio/issues/57 You are receiving this because you are subscribed to this thread.
Message ID: @.***>
I managed to make it work. First I have to use telnet(rfc2217) and enter the 'c' character on boot to enable xmodem mode (Entering 'c' with tcp does not work).
gensiot --server -i 'serialdev,/dev/ttyUSB0,115200n81,local' -a 'telnet(rfc2217),5000'
telnet localhost 5000
<press 'c'>
When the device entered xmodem mode, I kill gensiot and restart it using tcp and start sx:
gensiot --server -i 'serialdev,/dev/ttyUSB0,115200n81,local' -a 'tcp,5000'
$ sx -vv -X -b --tcp-client localhost:5000 <file>
connecting to [localhost] <5000>
Sending <file>, 592 blocks: Give your local XMODEM receive command now.
Bytes Sent: 75776 BPS:7964
Transfer complete
In ser2net I can configure both telnet(rfc2217) and tcp on a different port so I think this is a workable situation. I did not need to use rtscts.
Thanks!
On Mon, Jun 05, 2023 at 01:22:54AM -0700, pieterverberne wrote:
I managed to make it work. First I have to use telnet(rfc2217) and enter the 'c' character on boot to enable xmodem mode (Entering 'c' with tcp does not work).
gensiot --server -i 'serialdev,/dev/ttyUSB0,115200n81,local' -a 'telnet(rfc2217),5000' telnet localhost 5000 <press 'c'>
Ah, yes, that's because you are using telnet to connect and enter the "c". If you did the following:
gensiot --server -i 'serialdev,/dev/ttyUSB0,115200n81,local' -a 'tcp,5000'
gensiot tcp,localhost,5000
<press 'c'>
<press '^\q' to quit gensio>
Where ^\ is ctrl-\, the default command character for gensiot, it would probably work, because telnet sends a bunch of stuff for the telnet negotiations that probably screw things up. You might also be able to do:
echo -e -n "c\r" | gensiot 'serialdev,/dev/ttyUSB0,115200n81,local'
gensiot --server -i 'serialdev,/dev/ttyUSB0,115200n81,local' -a 'tcp,5000'
to make it more automatic.
-corey
Did this work for you? If so, can you close this? Thanks.
Using the combination of telnet(rfc2217) to do user input and tcp for xmodem works in my situation. I did not try you latest suggestion yet. Thanks for the help!
I'm trying to use gensio to transfer a file over xmodem:
gensiot --server -i 'serialdev,/dev/ttyUSB0,115200n81,local' -a 'telnet(rfc2217),5000'
(I also tried 'telnet' and 'tcp')
Next I use pyserial or sx to start the file transfer:
Example: https://pypi.org/project/xmodem/
sx -vv -X -b --tcp-client localhost:5000 <file>
In both cases I get "NAK on sector". Direct xmodem transfers (screen + sx) work fine. It is (or should it be) possible use xmodem via gensio?
Thanks!