1

I'm using the last example in: this post.

I keep getting wctx:file length=0 after the sz command. I'm actually opening the serial connection with minicom Minicom is botching the transfer. So, after I get to press enter to begin update in the minicom window, at which point the normal course is to go into the menu, select S for send, choose Xmodem, locate the firmware file and select it, at which point the transfer begins and fails almost immediately.

I move to a different virtual terminal window, and run sz -X -k -b -vvv - /tmp/sz_fifo > /dev/ttyUSB0 < /dev/ttyUSB0 after which I receive sz 0.12.21rc mode:1 sending s20806.lsz 0 blocks: give your Xmodem receive command now and I move into the minicom window where it still says to begin update press enter I hit enter, and get this in the sz window Xmodem sectors/kbytes sent 0/ 0kretry Timeout on sector ACK the last part repeated several times, then retry count exceeded followed by mode:0.

I don't know if the fifo is empty, if I need to select Xmodem protocol in minicom, or what! I'm about to try using Windows for this job. I am far from from expert on modem protocols and fifos. Although I started somewhere around Debian Woody.

In response to the comment, "hit enter before you hit s",

Using minicom, update works by accessing the serial interface of the embedded card. Two options provided by the embedded card, CRCXmodem and 1K-Xmodem.

I select 1K-Xmodem, and the response, "detatch terminal, change speed to 115,600, and reconnect". The card changes its own speed. Minicom reconnects after the speed change in port settings, and the embedded card says, "press enter to begin firmware update".

At this point the written instructions in the manual for the embedded card read, "send firmware update file". I hit CTRLA + z for the minicom menu, select 'S' for send, at which point I can choose a protocol. I choose Xmodem, and a file browser appears, which I use to select the firmware file.

Upon hitting enter, the update begins, shortly to fail. If I hit enter before I select 'S' in the minicom menu, nothing is sent, and the update fails. If I hit enter before accessing the minicom menu, the timer on the embedded card expires and the update fails.

I was trying sz, because it worked in the link I provided above, using a named pipe. Without minicom, I don't know how to prepare the embedded system to receive the firmware, but minicom fails after that point.

I was attempting to remedy that specific problem, especially since minicom has no option specifically for 1K-Xmodem, only Xmodem. Whereas, sz has the -k switch for 1K-Xmodem, as is specified in the options the card offers.

5
  • Try without -b option? Commented Aug 23, 2021 at 4:26
  • I get the exact same result without the -b option. It seems like it's something with the fifo, like it's not opening correctly, is empty, is not in the working directory. Perhaps if I wrote a script, so I have more control over the environment. I'm going to try Windows Terminal, on a lappy with a real serial port. Commented Aug 23, 2021 at 16:21
  • Hit Enter before selecting S for send. Choose the protocol the firmware is expecting. Don’t try to run sz in another window, minicom should run it if configured correctly (that’s what S does). Commented Aug 24, 2021 at 5:37
  • minicom just runs sz in the background ... run minicom -s as root, select File transfer protocols, then define a protocol for Xmodem-1K (called xmodem1k I would suggest), which calls the sx command with the -k option (plus probably -vv) i.e. command will be /usr/bin/sz -k -vv. I would suggest U/D should be U, FullScr should be N, IO-Red. should be Y and Multi should be N. Not sure about Name - probably should be Y (does this mean it provides the file name?). After doing this, when you do a Ctrl-Z S, xmodem1k should appear in the list of protocols. Commented Aug 26, 2021 at 8:45
  • I'm leaving this problem here. I followed your advice, which probably would work in any other situation. I think these embedded cards are just ultra finicky! Thanks a bunch. Can't win them all. Commented Sep 7, 2021 at 5:50

1 Answer 1

0

Many device access problems are permission problems, and can be resolved through group membership changes.

Specifically, if ls -l /dev/ttyUSB0 shows that the group permissions (the second "rwx" triplet) is "rw" (e.g."-rw-rw----"), then, adding oneself to the group that owns the device will grant rw access.

Here's how:

# change to your device name 
device="/dev/ttyUSB0"
sudo adduser $USER $(stat -c "%G" $device)

This allows you membership in the group that can rw the device, but there is one more step.

To make all your processes members of the new group, logout and login. Group memberships are set up at login time.

To create a single process in the new group (for testing, prior to logout/login):

newgrp $(stat -c "%G" $device)  

or, just type the group name. See man newgrp.

2
  • Minor question, but for man newgrp, which of man7.org/linux/man-pages/man1/newgrp.1.html and man7.org/linux/man-pages/man1/newgrp.1p.html would have been the version of the manpage you were expecting to see? Commented Aug 1, 2024 at 8:56
  • @AJM man newgrp will document the newgrp on your system. man man will tell you about manpage sections (the difference between .1 and .1p). Commented Aug 1, 2024 at 13:22

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.