[Bug 214637] [patch] sysutils/flashrom: serprog hangs
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Fri Nov 18 20:06:18 UTC 2016
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=214637
Bug ID: 214637
Summary: [patch] sysutils/flashrom: serprog hangs
Product: Ports & Packages
Version: Latest
Hardware: Any
OS: Any
Status: New
Keywords: patch
Severity: Affects Some People
Priority: ---
Component: Individual Port(s)
Assignee: freebsd-ports-bugs at FreeBSD.org
Reporter: mizhka at gmail.com
CC: nukama+maintainer at gmail.com
CC: nukama+maintainer at gmail.com
Flags: maintainer-feedback?(nukama+maintainer at gmail.com)
Keywords: patch
Created attachment 177152
--> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=177152&action=edit
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.
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-ports-bugs
mailing list