Summary: | [patch] sysutils/flashrom: serprog hangs | ||||||
---|---|---|---|---|---|---|---|
Product: | Ports & Packages | Reporter: | Michael Zhilin <mizhka> | ||||
Component: | Individual Port(s) | Assignee: | Tobias Kortkamp <tobik> | ||||
Status: | Closed FIXED | ||||||
Severity: | Affects Some People | CC: | nukama+maintainer, tobik | ||||
Priority: | --- | Keywords: | patch | ||||
Version: | Latest | Flags: | bugzilla:
maintainer-feedback?
(nukama+maintainer) |
||||
Hardware: | Any | ||||||
OS: | Any | ||||||
URL: | https://patchwork.coreboot.org/patch/4498/ | ||||||
Attachments: |
|
Update: patch has been sent to upstream & accepted (flashrom team is moving from SVN to GIT and doesn't yet published last commits). Could you please commit it to ports tree? Thanks! Maintainer timeout A commit references this bug: Author: tobik Date: Mon Feb 20 20:24:12 UTC 2017 New revision: 434487 URL: https://svnweb.freebsd.org/changeset/ports/434487 Log: Add patch to turn off the IEXTEN local flag and fix serprog hangs PR: 214637 Submitted by: Michael Zhiling <mizhka@gmail.com> Approved by: lme (mentor), maintainer timeout (nukama+maintainer@gmail.com, 3 months) Differential Revision: https://reviews.freebsd.org/D9696 Changes: head/sysutils/flashrom/Makefile head/sysutils/flashrom/files/ head/sysutils/flashrom/files/patch-serial.c Committed, thanks. |
Created attachment 177152 [details] SVN patch file Hi, Use case: flashrom is used to read SPI flash (MX25L6406) via Arduino Nano V3. Command: /usr/local/bin/flashrom -p serprog:dev=/dev/cuaU0:57600 -c MX25L6406E/MX25L6408E -r tcw770.dump It hangs after 5 seconds on read from tty ("ttyin"): (gdb) bt #0 _read () at _read.S:3 #1 0x00000008014ae736 in __thr_read (fd=3, buf=0x801c02bec, nbytes=20) at /builds/FreeBSD-src-head/lib/libthr/thread/thr_syscalls.c:402 #2 0x000000000042cd73 in serialport_read (buf=0x801c02bec "", readcnt=<value optimized out>) at serial.c:422 #3 0x000000000041d239 in sp_docommand (command=<value optimized out>, parmlen=10, params=0x801a27010 "\004", retlen=11264, retparms=0x801c00000) at serprog.c:239 #4 0x000000000041d6b1 in serprog_spi_send_command (flash=<value optimized out>, writecnt=<value optimized out>, readcnt=<value optimized out>, writearr=0x7fffffffe35c "\003", readarr=<value optimized out>) at serprog.c:930 #5 0x000000000040a8a4 in spi_nbyte_read (flash=0x3, address=<value optimized out>, bytes=0xffffffff81918118 <Error reading address 0xffffffff81918118: Bad address>, len=20) at spi25.c:937 #6 0x000000000041d73a in serprog_spi_read (flash=<value optimized out>, buf=0x801c00000 "\v�\002�", start=0, len=<value optimized out>) at serprog.c:948 #7 0x000000000042a1fd in read_flash_to_file (flash=0x7fffffffe460, filename=0x801a27000 "tcw770.dump") at flashrom.c:1383 #8 0x000000000040430a in main (argc=0, argv=0x7fffffffe670) at cli_classic.c:545 (gdb) kill The problem is that ttydisc_rint ignore same bytes. It happens due to enable IEXTEN local flag of termios. As results Arduino reads 11264 bytes, but flashrom gets 11244 bytes (corrupted) and waits for remaining 20 bytes. The fix is simple: turn off IEXTEN local flag. Tested on Arduino Nano V3 + FreeBSD 12-CURRENT. Portlint looks fine.