Skip to content
Navigation Menu
{{ message }}
-
Notifications
You must be signed in to change notification settings - Fork 80
Expand file tree
/
Copy pathorblcd.c
More file actions
781 lines (643 loc) · 25.8 KB
/
Copy pathorblcd.c
File metadata and controls
781 lines (643 loc) · 25.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
/* SPDX-License-Identifier: BSD-3-Clause */
/*
* OrbLCD remote display
* =====================
*
* Note that this file can be used as a generic skeleton for an ITM processing application. The app-specific code
* is clearly labelled in sections ***** APPLICATION SPECIFIC *****...the other stuff should be pretty much
* boiler-place for any ITM processing app. There will obviously be some changes needed (e.g. options setting)
* but they should be pretty minimal and simple to spot.
*
*/
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdlib.h>
#include <getopt.h>
#include <ctype.h>
#include <unistd.h>
#include <SDL.h>
#include <SDL_thread.h>
#include <signal.h>
#include "git_version_info.h"
#include "generics.h"
#include "itmDecoder.h"
#include "msgDecoder.h"
#include "oflow.h"
#include "stream.h"
#include "nw.h"
#include "orblcd_protocol.h"
/************** APPLICATION SPECIFIC ********************************************************************/
/* Target application specifics */
struct TApp
{
/* Application specific Options */
int chan; /* The channel we are listening on */
int sbcolour; /* Colour to be used for single bit renders */
/* Operational stuff */
int x; /* Current X pos */
int y; /* Current Y pos */
float scale; /* Scale for output window */
int modeDescriptor; /* Descriptor for source mode */
char *windowTitle; /* Title for SDL output window */
/* SDL stuff */
SDL_Window *mainWindow; /* Output window */
SDL_Texture *ctexture; /* Texture used for holding current image */
SDL_Renderer *renderer; /* Renderer onto output window */
SDL_Texture *texture; /* Texture used for construction of image */
uint8_t *pixels; /* Pixel buffer in texture */
uint32_t map8to24bit[256]; /* Colour index table for 8 to 24 bit mapping */
int pwidth; /* Width of one line of pixel buffer */
} _app =
{
.chan = LCD_DATA_CHANNEL,
.sbcolour = 0x00ff00,
.scale = 1.5f,
.windowTitle = "ORBLcd Output Window"
};
/************** APPLICATION SPECIFIC ENDS ***************************************************************/
enum Prot { PROT_OFLOW, PROT_ITM, PROT_UNKNOWN };
const char *protString[] = {"OFLOW", "ITM", NULL};
/* Record for options, either defaults or from command line */
struct Options
{
/* Source information */
int port; /* Source port, or zero if no port set */
char *server; /* Source server */
enum Prot protocol; /* What protocol to communicate (default to OFLOW (== orbuculum)) */
char *file; /* File host connection */
bool fileTerminate; /* Terminate when file read isn't successful */
/* Demux information */
uint32_t tag; /* Which OFLOW stream are we decoding? */
bool forceITMSync; /* Do we need ITM syncs? */
} _options = {.forceITMSync = true, .tag = 1, .port = OFCLIENT_SERVER_PORT, .server = "localhost"};
struct RunTime
{
/* The decoders and the packets from them */
struct ITMDecoder i;
struct ITMPacket h;
struct OFLOW c;
bool ending; /* Flag indicating app is terminating */
bool errored; /* Flag indicating problem in reception process */
struct Frame cobsPart; /* Any part frame that has been received */
int f; /* File handle to data source */
struct Options *options; /* Command line options (reference to above) */
struct TApp *app; /* Data storage for target application */
} _r =
{
.options = &_options,
.app = &_app,
};
/************** APPLICATION SPECIFIC ******************************************************************/
// Target application specifics
// ====================================================================================================
static void _paintPixels( struct swMsg *m, struct RunTime *r )
{
/* This is LCD data */
int d = m->value;
int y;
if ( !r->app->pixels )
{
/* For whatever reason we aren't initialised yet */
return;
}
for ( int b = m->len*8/ORBLCD_GET_DEPTH( r->app->modeDescriptor ) - 1; b >= 0; b-- )
//for ( int b = ORBLCD_PIXELS_PER_WORD( r->app->modeDescriptor ) - 1; b >= 0; b-- )
{
switch ( ORBLCD_DECODE_D( r->app->modeDescriptor ) )
{
case ORBLCD_DEPTH_1:
if ( ORBLCD_DECODE_L( r->app->modeDescriptor ) )
{
y = ( d & ( 128 >> ( b % 8 ) ) ) ? r->app->sbcolour : 0;
}
else
{
y = ( d & ( 1 << ( b % 8 ) ) ) ? r->app->sbcolour : 0;
}
if ( !( b % 8 ) )
{
d >>= 8;
}
break;
case ORBLCD_DEPTH_8:
y = r->app->map8to24bit[d & 0xff];
d >>= 8;
break;
case ORBLCD_DEPTH_16:
y = ( ( d & 0xF100 ) << 8 ) | ( ( d & 0x07e0 ) << 5 ) | ( d & 0x001f );
d >>= 16;
break;
case ORBLCD_DEPTH_24:
y = d;
break;
default:
y = 0xff;
break;
}
/* Output bitdepth is always the same, so span calculation is too */
*( uint32_t * )&r->app->pixels[r->app->x * 4 + r->app->y * r->app->pwidth] = y | 0xff000000;
if ( ++r->app->x >= ORBLCD_DECODE_X( r->app->modeDescriptor ) )
{
r->app->y++;
r->app->x = 0;
if ( r->app->y == ORBLCD_DECODE_Y( r->app->modeDescriptor ) )
{
r->app->y = 0;
}
break;
}
}
}
/*************************************/
static void _handleCommand( struct swMsg *m, struct RunTime *r )
{
/* This is control data */
switch ( ORBLCD_DECODE_C( m->value ) )
{
case ORBLCD_CMD_INIT_LCD: // -------------------------------------------------------
if ( ( !r->app->mainWindow ) || ( m->value != r->app->modeDescriptor ) )
{
/* Create a new, or replacement, SDL window */
genericsReport( V_ERROR, "%s window %dx%d, depth %d" EOL,
( r->app->modeDescriptor ) ? "Replacement" : "New",
ORBLCD_DECODE_X( m->value ), ORBLCD_DECODE_Y( m->value ), ORBLCD_GET_DEPTH( m->value ) );
r->app->modeDescriptor = m->value;
/* If this is due to a resize activity then destroy the old stuff */
if ( r->app->renderer )
{
SDL_DestroyRenderer( r->app->renderer );
}
if ( r->app->mainWindow )
{
SDL_DestroyWindow( r->app->mainWindow );
}
if ( r->app->pixels )
{
free( r->app->pixels );
}
r->app->mainWindow = SDL_CreateWindow( r->app->windowTitle,
SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
ORBLCD_DECODE_X( r->app->modeDescriptor ) * r->app->scale, ORBLCD_DECODE_Y( r->app->modeDescriptor ) * r->app->scale, SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE );
SDL_SetHint( SDL_HINT_RENDER_SCALE_QUALITY, "1" );
r->app->renderer = SDL_CreateRenderer( r->app->mainWindow, -1, SDL_RENDERER_ACCELERATED );
SDL_RenderSetLogicalSize( r->app->renderer, ORBLCD_DECODE_X( r->app->modeDescriptor ), ORBLCD_DECODE_Y( r->app->modeDescriptor ) );
r->app->texture = SDL_CreateTexture( r->app->renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STATIC, ORBLCD_DECODE_X( r->app->modeDescriptor ), ORBLCD_DECODE_Y( r->app->modeDescriptor ) );
/* Create the memory for drawing the image */
r->app->pwidth = sizeof( uint32_t ) * ORBLCD_DECODE_X( r->app->modeDescriptor );
r->app->pixels = ( uint8_t * )calloc( ORBLCD_DECODE_Y( r->app->modeDescriptor ) * r->app->pwidth, 1 );
}
else
{
/* Repaint the SDL window */
SDL_UpdateTexture( r->app->texture, NULL, r->app->pixels, r->app->pwidth );
SDL_RenderCopy( r->app->renderer, r->app->texture, NULL, NULL );
SDL_RenderPresent( r->app->renderer );
}
r->app->x = r->app->y = 0;
break;
case ORBLCD_CMD_CLEAR: // -------------------------------------------------------------
if ( r->app->pixels )
{
memset( r->app->pixels, 0, ORBLCD_DECODE_Y( r->app->modeDescriptor ) * r->app->pwidth );
}
break;
case ORBLCD_CMD_GOTOXY: // ------------------------------------------------------------
if ( ORBLCD_DECODE_X( m->value ) < ORBLCD_DECODE_X( r->app->modeDescriptor ) )
{
r->app->x = ORBLCD_DECODE_X( m->value );
}
if ( ORBLCD_DECODE_Y( m->value ) < ORBLCD_DECODE_Y( r->app->modeDescriptor ) )
{
r->app->y = ORBLCD_DECODE_Y( m->value );
}
break;
default: // --------------------------------------------------------------------------------------------
genericsReport( V_INFO, "Unknown LCD protocol message %d,length %d" EOL, ORBLCD_DECODE_C( m->value ), m->len );
break;
}
}
/*************************************/
static void _handleSW( struct swMsg *m, struct RunTime *r )
{
if ( ( m->srcAddr == r->app->chan ) && ( r->app->pixels ) )
{
_paintPixels( m, r );
}
else if ( m->srcAddr == r->app->chan + 1 )
{
_handleCommand( m, r );
}
}
/************** APPLICATION SPECIFIC ENDS ***************************************************************/
// ====================================================================================================
// Generic Stream processing to extract data from incoming stream
// ====================================================================================================
void _itmPumpProcess( char c, struct RunTime *r )
{
struct msg decoded;
switch ( ITMPump( &r->i, c ) )
{
case ITM_EV_NONE:
break;
case ITM_EV_UNSYNCED:
genericsReport( V_INFO, "ITM Unsynced" EOL );
break;
case ITM_EV_SYNCED:
genericsReport( V_INFO, "ITM Synced" EOL );
break;
case ITM_EV_OVERFLOW:
genericsReport( V_INFO, "ITM Overflow" EOL );
break;
case ITM_EV_ERROR:
genericsReport( V_WARN, "ITM Error" EOL );
break;
case ITM_EV_PACKET_RXED:
ITMGetDecodedPacket( &_r.i, &decoded );
/* See if we decoded a dispatchable match. genericMsg is just used to access */
/* the first two members of the decoded structs in a portable way. */
if ( decoded.genericMsg.msgtype == MSG_SOFTWARE )
{
_handleSW( ( struct swMsg * )&decoded, r );
}
break;
default:
break;
}
}
// ====================================================================================================
static struct Stream *_tryOpenStream( struct RunTime *r )
{
if ( r->options->file != NULL )
{
return streamCreateFile( r->options->file );
}
else
{
return streamCreateSocket( r->options->server, r->options->port );
}
}
// ====================================================================================================
static void _OFLOWpacketRxed ( struct OFLOWFrame *p, void *param )
{
struct RunTime *r = ( struct RunTime * )param;
if ( !p->good )
{
genericsReport( V_INFO, "Bad packet received" EOL );
}
else
{
if ( p->tag == r->options->tag )
{
for ( int i = 0; i < p->len; i++ )
{
_itmPumpProcess( p->d[i], r );
}
}
}
}
// ====================================================================================================
static bool _feedStream( struct Stream *stream, struct RunTime *r )
{
unsigned char cbw[TRANSFER_SIZE];
struct timeval t =
{
.tv_sec = 0,
.tv_usec = 100000
};
SDL_Event e;
while ( !_r.ending )
{
size_t receivedSize;
enum ReceiveResult result = stream->receive( stream, cbw, TRANSFER_SIZE, &t, &receivedSize );
/* Check for SDL close */
while ( SDL_PollEvent( &e ) != 0 )
{
if ( e.type == SDL_QUIT )
{
return false;
}
}
if ( result != RECEIVE_RESULT_OK )
{
if ( result == RECEIVE_RESULT_EOF && r->options->fileTerminate )
{
return true;
}
else if ( result == RECEIVE_RESULT_ERROR )
{
break;
}
else
{
usleep( 100000 );
}
}
if ( PROT_OFLOW == r->options->protocol )
{
OFLOWPump( &_r.c, cbw, receivedSize, _OFLOWpacketRxed, &_r );
}
else
{
unsigned char *c = cbw;
while ( receivedSize-- )
{
_itmPumpProcess( *c++, r );
}
}
}
return true;
}
// ====================================================================================================
// Application Setup stuff
// ====================================================================================================
void _printHelp( const char *const progName )
{
genericsFPrintf( stderr, "Usage: %s [options]" EOL, progName );
genericsFPrintf( stderr, " -c, --channel: <Number> of first channel in pair containing display data" EOL );
genericsFPrintf( stderr, " -f, --input-file: <filename> Take input from specified file" EOL );
genericsFPrintf( stderr, " -h, --help: This help" EOL );
genericsFPrintf( stderr, " -n, --itm-sync: Enforce sync requirement for ITM (i.e. ITM needs to issue syncs)" EOL );
genericsFPrintf( stderr, " -p, --protocol: Protocol to communicate. Defaults to OFLOW if -s is not set, otherwise ITM" EOL );
genericsFPrintf( stderr, " -s, --server: <Server>:<Port> to use" EOL );
genericsFPrintf( stderr, " -S, --sbcolour: <Colour> to be used for single bit renders, ignored for other bit depths" EOL );
genericsFPrintf( stderr, " -t, --tag: <stream> Which OFLOW tag to use (normally 1)" EOL );
genericsFPrintf( stderr, " -v, --verbose: <level> Verbose mode 0(errors)..3(debug)" EOL );
genericsFPrintf( stderr, " -V, --version: Print version and exit" EOL );
genericsFPrintf( stderr, " -w, --window: <string> Set title for output window" EOL );
genericsFPrintf( stderr, " -z, --size: <Scale(float)> Set relative size of output window (normally 1.0)" EOL );
}
// ====================================================================================================
void _printVersion( void )
{
genericsFPrintf( stderr, "orblcd version " GIT_DESCRIBE EOL );
}
// ====================================================================================================
static struct option _longOptions[] =
{
{"channel", required_argument, NULL, 'c'},
{"eof", no_argument, NULL, 'E'},
{"help", no_argument, NULL, 'h'},
{"input-file", required_argument, NULL, 'f'},
{"itm-sync", no_argument, NULL, 'n'},
{"protocol", required_argument, NULL, 'p'},
{"server", required_argument, NULL, 's'},
{"sbcolour", required_argument, NULL, 'S'},
{"sbcolor", required_argument, NULL, 'S'},
{"tag", required_argument, NULL, 't'},
{"verbose", required_argument, NULL, 'v'},
{"version", no_argument, NULL, 'V'},
{"window", required_argument, NULL, 'w'},
{"size", required_argument, NULL, 'z'},
{NULL, no_argument, NULL, 0}
};
// ====================================================================================================
bool _processOptions( int argc, char *argv[], struct RunTime *r )
{
int c, optionIndex = 0;
bool protExplicit = false;
bool serverExplicit = false;
bool portExplicit = false;
while ( ( c = getopt_long ( argc, argv, "c:Ef:hnp:s:S:t:v:Vw:z:", _longOptions, &optionIndex ) ) != -1 )
switch ( c )
{
// ------------------------------------
case 'c':
r->app->chan = atoi( optarg );
break;
// ------------------------------------
case 'E':
r->options->fileTerminate = true;
break;
// ------------------------------------
case 'f':
r->options->file = optarg;
break;
// ------------------------------------
case 'h':
_printHelp( argv[0] );
return false;
// ------------------------------------
case 'n':
r->options->forceITMSync = false;
break;
// ------------------------------------
case 'p':
r->options->protocol = PROT_UNKNOWN;
protExplicit = true;
for ( int i = 0; protString[i]; i++ )
{
if ( !strcmp( protString[i], optarg ) )
{
r->options->protocol = i;
break;
}
}
if ( r->options->protocol == PROT_UNKNOWN )
{
genericsReport( V_ERROR, "Unrecognised protocol type" EOL );
return false;
}
break;
// ------------------------------------
case 'V':
_printVersion();
return false;
// ------------------------------------
case 's':
r->options->server = optarg;
serverExplicit = true;
// See if we have an optional port number too
char *a = optarg;
while ( ( *a ) && ( *a != ':' ) )
{
a++;
}
if ( *a == ':' )
{
*a = 0;
r->options->port = atoi( ++a );
}
if ( !r->options->port )
{
r->options->port = NWCLIENT_SERVER_PORT;
}
else
{
portExplicit = true;
}
break;
// ------------------------------------
case 'S':
r->app->sbcolour = strtol( optarg, NULL, 0 );
break;
// ------------------------------------
case 't':
r->options->tag = atoi( optarg );
break;
// ------------------------------------
case 'v':
if ( !isdigit( *optarg ) )
{
genericsReport( V_ERROR, "-v requires a numeric argument." EOL );
return false;
}
genericsSetReportLevel( atoi( optarg ) );
break;
// ------------------------------------
case 'w':
r->app->windowTitle = optarg;
break;
// ------------------------------------
case 'z':
r->app->scale = atof( optarg );
break;
// ------------------------------------
case '?':
if ( optopt == 'b' )
{
genericsReport( V_ERROR, "Option '%c' requires an argument." EOL, optopt );
}
else if ( !isprint ( optopt ) )
{
genericsReport( V_ERROR, "Unknown option character `\\x%x'." EOL, optopt );
}
return false;
// ------------------------------------
default:
genericsReport( V_ERROR, "Unrecognised option '%c'" EOL, c );
return false;
// ------------------------------------
}
/* ... and dump the config if we're being verbose */
_printVersion();
/* If we set an explicit server and port and didn't set a protocol chances are we want ITM, not OFLOW */
if ( serverExplicit && !protExplicit )
{
r->options->protocol = PROT_ITM;
}
if ( ( r->options->protocol == PROT_ITM ) && !portExplicit )
{
r->options->port = NWCLIENT_SERVER_PORT;
}
genericsReport( V_INFO, "App Channel : Data=%d, Control=%d" EOL, r->app->chan, r->app->chan + 1 );
genericsReport( V_INFO, "SB Colour : 0x%x" EOL, r->app->sbcolour );
genericsReport( V_INFO, "Relative Scale : %1.2f:1" EOL, r->app->scale );
genericsReport( V_INFO, "Window Title : %s" EOL, r->app->windowTitle );
if ( r->options->port )
{
genericsReport( V_INFO, "NW SERVER H&P : %s:%d" EOL, r->options->server, r->options->port );
}
if ( r->options->file )
{
genericsReport( V_INFO, "Input File : %s", r->options->file );
if ( r->options->fileTerminate )
{
genericsReport( V_INFO, " (Terminate on exhaustion)" EOL );
}
else
{
genericsReport( V_INFO, " (Ongoing read)" EOL );
}
}
if ( ( r->options->file ) && ( r->options->port ) )
{
genericsReport( V_ERROR, "Cannot specify file and port or NW Server at same time" EOL );
return false;
}
switch ( r->options->protocol )
{
case PROT_OFLOW:
genericsReport( V_INFO, "Decoding OFLOW (Orbuculum) with ITM in stream %d" EOL, r->options->tag );
break;
case PROT_ITM:
genericsReport( V_INFO, "Decoding ITM" EOL );
break;
default:
genericsReport( V_INFO, "Decoding unknown" EOL );
break;
}
return true;
}
// ====================================================================================================
static void _intHandler( int sig )
{
/* CTRL-C exit is not an error... */
_r.ending = true;
}
// ====================================================================================================
// ====================================================================================================
// ====================================================================================================
// Externally available routines
// ====================================================================================================
// ====================================================================================================
// ====================================================================================================
int main( int argc, char *argv[] )
{
bool alreadyReported = false;
if ( !_processOptions( argc, argv, &_r ) )
{
exit( -1 );
}
/* Reset the handlers before we start */
ITMDecoderInit( &_r.i, _r.options->forceITMSync );
OFLOWInit( &_r.c );
if ( SDL_Init( SDL_INIT_VIDEO ) < 0 )
{
genericsExit( -1, "Could not initailise SDL" );
}
/* This ensures the signal handler gets called */
if ( SIG_ERR == signal( SIGINT, _intHandler ) )
{
genericsExit( -1, "Failed to establish Int handler" EOL );
}
/* Load up default colour index map R3G3B2 */
for ( int i = 0; i < 256; i++ )
{
_r.app->map8to24bit[i] = ( ( i & 0xE0 ) << 21 ) | ( ( i & 0x1c ) << 13 ) | ( i << 6 );
}
while ( !_r.ending )
{
struct Stream *stream = NULL;
while ( !_r.ending )
{
stream = _tryOpenStream( &_r );
if ( stream != NULL )
{
if ( alreadyReported )
{
genericsReport( V_INFO, "Connected" EOL );
alreadyReported = false;
}
break;
}
if ( !alreadyReported )
{
genericsReport( V_INFO, EOL "No connection" EOL );
alreadyReported = true;
}
if ( _r.options->fileTerminate )
{
break;
}
/* Checking every 100ms for a connection is quite often enough */
usleep( 100000 );
}
if ( stream != NULL )
{
if ( !_feedStream( stream, &_r ) )
{
break;
}
stream->close( stream );
free( stream );
}
if ( _r.options->fileTerminate )
{
break;
}
}
SDL_Quit();
return 0;
}
// ====================================================================================================
You can’t perform that action at this time.
