xmodem

What is the value of size to be provided for the getc method in xmodem protocol?

狂风中的少年 提交于 2020-01-01 19:45:24
问题 I'm trying to transfer a file using the XMODEM protocol. I saw and did not understand the solution provided in: Can I use the xmodem protocol with PySerial? I saw xmodem package link. What is the value of size to be provided for the getc method? It is not assigned with any value given in the first link. When I use simple method as explained in the second link, I end up getting the error: No handlers could be found for logger "xmodem" . Here is my code to send the file. import serial from

XMODEM for python

会有一股神秘感。 提交于 2019-12-22 17:42:11
问题 I am writing a program that requires the use of XMODEM to transfer data from a sensor device. I'd like to avoid having to write my own XMODEM code, so I was wondering if anyone knew if there was a python XMODEM module available anywhere? 回答1: def xmodem_send(serial, file): t, anim = 0, '|/-\\' serial.setTimeout(1) while 1: if serial.read(1) != NAK: t = t + 1 print anim[t%len(anim)],'\r', if t == 60 : return False else: break p = 1 s = file.read(128) while s: s = s + '\xFF'*(128 - len(s)) chk

CRC calculation in Java

别来无恙 提交于 2019-12-13 15:22:29
问题 I'm reading a file from serialport using x-modem protocol and 133 bytes packet. I'm reading in that 1 byte is SOH 2 byte packet number 3 byte nagative of packet number next 128 bytes data 2 bytes CRC sent from other side. I have to calculate CRC of 128 bytes data and 2 bytes crc sent from other side that I have to make it single byte and have to comapare with my calculated crc. How can I do this in java? 回答1: Try using Jacksum. 回答2: Sun JDK 1.6 contains sun.misc.CRC16, but there is a

jssc getInputStream() getOutputstream()

耗尽温柔 提交于 2019-12-12 01:44:46
问题 I'm using jssc library for communicating with device over serial port. In standard java SerialComm library there are two methods getInputStream() and getOutputStream(). Why I need this? I want to implement Xmodem according to this example and xmodem constructor requires two params: public Xmodem(InputStream inputStream, OutputStream outputStream) { this.inputStream = inputStream; this.outputStream = outputStream; } Xmodem xmodem = new Xmodem(serialPort.getInputStream(),serialPort

Using Pyserial to send a file?

大憨熊 提交于 2019-12-08 01:56:47
问题 I have a Raspberry Pi connected to my Macbook Pro by two radio modules. I have been successful so far in sending strings and commands from one device to the other using pyserial, however, I cannot find a way to send a text file. Like on HyperTerminal, where you can choose to send a text file over xmodem. I have downloaded the xmodem library and played with it a bit, and I think I am able to send files, but I have no idea how to receive them on the other end. Any help? 回答1: this question is

XMODEM for python

夙愿已清 提交于 2019-12-06 06:29:30
I am writing a program that requires the use of XMODEM to transfer data from a sensor device. I'd like to avoid having to write my own XMODEM code, so I was wondering if anyone knew if there was a python XMODEM module available anywhere? def xmodem_send(serial, file): t, anim = 0, '|/-\\' serial.setTimeout(1) while 1: if serial.read(1) != NAK: t = t + 1 print anim[t%len(anim)],'\r', if t == 60 : return False else: break p = 1 s = file.read(128) while s: s = s + '\xFF'*(128 - len(s)) chk = 0 for c in s: chk+=ord(c) while 1: serial.write(SOH) serial.write(chr(p)) serial.write(chr(255 - p))

What is the value of size to be provided for the getc method in xmodem protocol?

爷,独闯天下 提交于 2019-12-04 20:09:30
I'm trying to transfer a file using the XMODEM protocol. I saw and did not understand the solution provided in: Can I use the xmodem protocol with PySerial? I saw xmodem package link . What is the value of size to be provided for the getc method? It is not assigned with any value given in the first link . When I use simple method as explained in the second link , I end up getting the error: No handlers could be found for logger "xmodem" . Here is my code to send the file. import serial from xmodem import XMODEM, CRC from time import sleep def getc(size, timeout=1): return port.read(size) def

Can I use the xmodem protocol with PySerial?

旧时模样 提交于 2019-12-04 14:24:12
问题 I have a working connection with my serial device via PySerial, but I also want to transfer files via the xmodem protocol as part of my program. Which would be the most platform-neutral way to do this? Worst case, I could close() my serial.Serial object in Python and use subprocess to call upon /usr/bin/sb , but that seems inelegant. I'm currently on Ubuntu 9.10 and am using a USB-TTY adapter. Any ideas? 回答1: There is xmodem module on PyPi. It takes two functions in constructor for reading

Can I use the xmodem protocol with PySerial?

我是研究僧i 提交于 2019-12-03 09:54:19
I have a working connection with my serial device via PySerial, but I also want to transfer files via the xmodem protocol as part of my program. Which would be the most platform-neutral way to do this? Worst case, I could close() my serial.Serial object in Python and use subprocess to call upon /usr/bin/sb , but that seems inelegant. I'm currently on Ubuntu 9.10 and am using a USB-TTY adapter. Any ideas? There is xmodem module on PyPi. It takes two functions in constructor for reading and writing data, implement them to work with your opened serial port. Below is simple sample of its usage:

Implementation of Xmodem protocol in Java

怎甘沉沦 提交于 2019-11-26 17:08:50
问题 How would I receive a file over a serial port in Java using the XMODEM protocol? 回答1: Here it is. I found this in the JModem source. If you look at where it writes the data out, you can see its doing an SOH, blocknum, ~blocknum, data, and checksum. It uses a sector size of 128. Those together make up the standard XModem protocol. Its simple enough to do XModem1K, YModem, and ZModem from here, too. /** * a tiny version of Ward Christensen's MODEM program for UNIX. * Written ~ 1980 by Andrew