@@ -306,38 +306,11 @@ void serialport_set_baudrate(unsigned int baudrate)
306
306
}
307
307
}
308
308
309
- void serialport_set_character_timeout_0_1s (unsigned int t )
310
- {
311
- if (t > 255 )
312
- t = 255 ;
313
- #ifndef __APPLE__
314
- term .c_cc [VMIN ] = 0 ;
315
- term .c_cc [VTIME ] = t ; // VTIME is measured in 0.1s
316
-
317
- LOGDEBUG ("setting character timeout %i" , t );
318
-
319
- if (tcsetattr (serial_port , TCSANOW , & term )!= 0 )
320
- {
321
- LOGDEBUG ("set timeout failed" );
322
- }
323
-
324
- LOGDEBUG ("done" );
325
- #endif
326
- timeout = t ;
327
- }
328
-
329
- unsigned serialport_get_character_timeout_0_1s ()
330
- {
331
- return term .c_cc [VTIME ];
332
- }
333
-
334
-
335
309
void serialport_set_timeout (unsigned int t )
336
310
{
337
311
if (t != timeout )
338
312
{
339
313
LOGDEBUG ("setting timeout %i" , t );
340
- serialport_set_character_timeout_0_1s ((t + 99 )/100 );
341
314
timeout = t ;
342
315
}
343
316
}
@@ -347,7 +320,6 @@ unsigned serialport_get_timeout()
347
320
return timeout ;
348
321
}
349
322
350
-
351
323
int serialport_open (const char * device , unsigned int baudrate )
352
324
{
353
325
LOGINFO ("opening port %s at %d" , device , baudrate );
@@ -445,17 +417,11 @@ unsigned serialport_write(const unsigned char* data, unsigned int size)
445
417
void serialport_flush (void )
446
418
{
447
419
static unsigned char b ;
448
- unsigned int t ;
449
420
450
421
if (serial_port )
451
422
{
452
- t = serialport_get_character_timeout_0_1s ();
453
- serialport_set_character_timeout_0_1s (0 );
454
-
455
423
tcdrain (serial_port );
456
424
while (read (serial_port , & b , 1 ) > 0 );
457
-
458
- serialport_set_character_timeout_0_1s (t );
459
425
}
460
426
}
461
427
0 commit comments