SerialPortHelper icon indicating copy to clipboard operation
SerialPortHelper copied to clipboard

串口读取IC卡出现分段返回

Open V-Beyond opened this issue 5 years ago • 4 comments

串口读取IC卡出现分段返回,这个问题需要怎么解决

V-Beyond avatar Jan 10 '20 11:01 V-Beyond

求 遇到了类似问题 分段返回 你解决了没呢

wangliss avatar Jun 12 '20 08:06 wangliss

增加isReceiveMaxSize的大小.或者直接写个32(就是64位长度的string)

AlexFugui avatar Jan 10 '21 21:01 AlexFugui

改了maxSize, 数据经常读取乱的.

gatspy avatar Jan 19 '21 15:01 gatspy

修改源码,在串口select后面加一点延时

if (FD_ISSET(fd, &rfds)) { FD_ZERO(&rfds); FD_SET(fd, &rfds); retval = select(fd + 1, &rfds, NULL, NULL, &tv); usleep(10000); if (retval == -1) { LOGE("Select error!"); } else if (retval) { LOGD("This device has data!"); ret = static_cast(read(fd, data, static_cast<size_t>(size))); } else { LOGE("Select timeout!"); } }

yyan avatar Jan 20 '22 17:01 yyan