解决插拔USB,USB nmea口无数据输出
Change-Id: I4a15e540bf3930e17b25fbd28ab4750e4614ab73
diff --git a/mbtk/mbtk_gnssd/gnss_main.c b/mbtk/mbtk_gnssd/gnss_main.c
index 8b91df2..a495f4f 100755
--- a/mbtk/mbtk_gnssd/gnss_main.c
+++ b/mbtk/mbtk_gnssd/gnss_main.c
@@ -322,6 +322,15 @@
if(gnss_usb_nmea_port_fd > 0) {
ret = write(gnss_usb_nmea_port_fd, nmea, nmea_len);
+ if(ret < 0 && errno != EAGAIN) {
+ LOGE("gnss_port_fd write fail [errno = %d].", errno);
+ if(errno == EIO) {
+ tcflush(gnss_usb_nmea_port_fd, TCIOFLUSH);
+ close(gnss_usb_nmea_port_fd);
+ gnss_usb_nmea_port_fd = -1;
+ gnss_usb_nmea_port_fd = gnss_port_open(GNSS_PORT_USB_NMEA, O_RDWR | O_NONBLOCK | O_NOCTTY, 115200, TRUE);
+ }
+ }
}
if(gnss_uart_at_port_fd > 0) {