Date: Fri, 18 Nov 2016 20:06:17 +0000 From: bugzilla-noreply@freebsd.org To: freebsd-ports-bugs@FreeBSD.org Subject: [Bug 214637] [patch] sysutils/flashrom: serprog hangs Message-ID: <bug-214637-13@https.bugs.freebsd.org/bugzilla/>
next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D214637 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@FreeBSD.org Reporter: mizhka@gmail.com CC: nukama+maintainer@gmail.com CC: nukama+maintainer@gmail.com Flags: maintainer-feedback?(nukama+maintainer@gmail.com) Keywords: patch Created attachment 177152 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D177152&action= =3Dedit SVN patch file Hi, Use case: flashrom is used to read SPI flash (MX25L6406) via Arduino Nano V3.=20 Command:=20 /usr/local/bin/flashrom -p serprog:dev=3D/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=3D3, buf=3D0x801c02bec, nbytes=3D2= 0) at /builds/FreeBSD-src-head/lib/libthr/thread/thr_syscalls.c:402 #2 0x000000000042cd73 in serialport_read (buf=3D0x801c02bec "", readcnt=3D= <value optimized out>) at serial.c:422 #3 0x000000000041d239 in sp_docommand (command=3D<value optimized out>, parmlen=3D10, params=3D0x801a27010 "\004", retlen=3D11264, retparms=3D0x801= c00000) at serprog.c:239 #4 0x000000000041d6b1 in serprog_spi_send_command (flash=3D<value optimized out>, writecnt=3D<value optimized out>, readcnt=3D<value optimized out>,=20 writearr=3D0x7fffffffe35c "\003", readarr=3D<value optimized out>) at serprog.c:930 #5 0x000000000040a8a4 in spi_nbyte_read (flash=3D0x3, address=3D<value opt= imized out>, bytes=3D0xffffffff81918118 <Error reading address 0xffffffff81918118:= Bad address>,=20 len=3D20) at spi25.c:937 #6 0x000000000041d73a in serprog_spi_read (flash=3D<value optimized out>, buf=3D0x801c00000 "\v=EF=BF=BD\002=EF=BF=BD", start=3D0, len=3D<value optim= ized out>) at serprog.c:948 #7 0x000000000042a1fd in read_flash_to_file (flash=3D0x7fffffffe460, filename=3D0x801a27000 "tcw770.dump") at flashrom.c:1383 #8 0x000000000040430a in main (argc=3D0, argv=3D0x7fffffffe670) 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.=20 Portlint looks fine. --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-214637-13>