Christian Heimke commited on 2011-07-15 09:04:22
Showing 14 changed files, with 252 additions and 76 deletions.
| ... | ... |
@@ -1,5 +1,5 @@ |
| 1 | 1 |
/* BlinkenLib |
| 2 |
- * version 0.5 date 2005-12-06 |
|
| 2 |
+ * version 0.5.1 date 2005-12-14 |
|
| 3 | 3 |
* Copyright 2004-2005 Stefan Schuermans <1stein@schuermans.info> |
| 4 | 4 |
* Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html |
| 5 | 5 |
* a blinkenarea.org project |
| ... | ... |
@@ -20,7 +20,7 @@ int main( int argCnt, char * * args ) |
| 20 | 20 |
|
| 21 | 21 |
//print info |
| 22 | 22 |
printf( "BlinkenLib - BlinkenConv\n" |
| 23 |
- "version 0.5 date 2005-12-06\n" |
|
| 23 |
+ "version 0.5.1 date 2005-12-14\n" |
|
| 24 | 24 |
"Copyright 2004-2005 Stefan Schuermans <1stein@schuermans.info>\n" |
| 25 | 25 |
"Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html\n" |
| 26 | 26 |
"a blinkenarea.org project\n\n" ); |
| ... | ... |
@@ -1,5 +1,5 @@ |
| 1 | 1 |
/* BlinkenLib |
| 2 |
- * version 0.5 date 2005-12-06 |
|
| 2 |
+ * version 0.5.1 date 2005-12-14 |
|
| 3 | 3 |
* Copyright 2004-2005 Stefan Schuermans <1stein@schuermans.info> |
| 4 | 4 |
* Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html |
| 5 | 5 |
* a blinkenarea.org project |
| ... | ... |
@@ -16,6 +16,7 @@ |
| 16 | 16 |
#include <arpa/inet.h> |
| 17 | 17 |
#include <netinet/in.h> |
| 18 | 18 |
#include <sys/types.h> |
| 19 |
+#include <sys/time.h> |
|
| 19 | 20 |
#include <sys/socket.h> |
| 20 | 21 |
|
| 21 | 22 |
#include "BlinkenLib.h" |
| ... | ... |
@@ -145,45 +146,64 @@ static int serial_settings_set( int fd, int settings ) |
| 145 | 146 |
return 1; |
| 146 | 147 |
} |
| 147 | 148 |
|
| 148 |
-//recevie frames from socket and output them |
|
| 149 |
-static void recv_and_out( int udpSocket, int dev_fd, |
|
| 149 |
+//receive frames from socket and output them |
|
| 150 |
+//dev_fd may be -1 for not doing anything with device |
|
| 151 |
+//returns error code (not for device-errors, 0 for success) |
|
| 152 |
+static int recv_and_out( int udpSocket, int dev_fd, |
|
| 153 |
+ int * p_device_output_active, |
|
| 150 | 154 |
unsigned int format_change, |
| 151 | 155 |
unsigned int format_height, unsigned int format_width, |
| 152 | 156 |
unsigned int format_channels, unsigned int format_colors, |
| 153 |
- etBlinkenProto proto ) |
|
| 157 |
+ etBlinkenProto proto, |
|
| 158 |
+ int use_msecs, unsigned int msecs ) |
|
| 154 | 159 |
{
|
| 155 | 160 |
fd_set readFds, errFds; |
| 156 |
- stBlinkenFrame * pLastFrame, * pFrame; |
|
| 161 |
+ stBlinkenFrame * pFrame; |
|
| 157 | 162 |
char buffer[65536]; //64kB is more than maximum UDP size |
| 158 |
- int maxFd, len; |
|
| 159 |
- int dev_eof = 0; |
|
| 163 |
+ int maxFd, len, dev_eof; |
|
| 164 |
+ struct timeval start, timeout, * p_timeout, end; |
|
| 160 | 165 |
|
| 166 |
+ dev_eof = 0; |
|
| 161 | 167 |
for( ; ; ) |
| 162 | 168 |
{
|
| 163 | 169 |
//wait for next frame |
| 164 | 170 |
FD_ZERO( &readFds ); |
| 165 | 171 |
FD_SET( udpSocket, &readFds ); |
| 166 |
- if( ! dev_eof ) |
|
| 172 |
+ if( dev_fd != -1 && ! dev_eof ) |
|
| 167 | 173 |
FD_SET( dev_fd, &readFds ); |
| 168 | 174 |
FD_ZERO( &errFds ); |
| 169 | 175 |
FD_SET( udpSocket, &errFds ); |
| 176 |
+ if( dev_fd != -1 ) |
|
| 170 | 177 |
FD_SET( dev_fd, &errFds ); |
| 171 | 178 |
maxFd = 0; |
| 172 | 179 |
if( udpSocket > maxFd ) |
| 173 | 180 |
maxFd = udpSocket; |
| 174 |
- if( dev_fd > maxFd ) |
|
| 181 |
+ if( dev_fd != -1 && dev_fd > maxFd ) |
|
| 175 | 182 |
maxFd = dev_fd; |
| 176 |
- if( select( maxFd + 1, &readFds, NULL, &errFds, NULL ) < 0 ) // error |
|
| 177 |
- break; |
|
| 183 |
+ if( use_msecs ) //timeout |
|
| 184 |
+ {
|
|
| 185 |
+ gettimeofday( &start, NULL ); |
|
| 186 |
+ timeout.tv_sec = msecs / 1000; |
|
| 187 |
+ timeout.tv_usec = msecs % 1000 * 1000; |
|
| 188 |
+ p_timeout = &timeout; |
|
| 189 |
+ } |
|
| 190 |
+ else |
|
| 191 |
+ p_timeout = NULL; |
|
| 192 |
+ if( select( maxFd + 1, &readFds, NULL, &errFds, p_timeout ) < 0 ) //error |
|
| 193 |
+ {
|
|
| 194 |
+ printf( "error during select: %s\n", strerror( errno ) ); |
|
| 195 |
+ return -1; |
|
| 196 |
+ } |
|
| 178 | 197 |
|
| 179 | 198 |
//error on socket or device |
| 180 | 199 |
if( FD_ISSET( udpSocket, &errFds ) ) |
| 181 | 200 |
{
|
| 182 | 201 |
printf( "error on socket\n" ); |
| 183 |
- break; |
|
| 202 |
+ return -1; |
|
| 184 | 203 |
} |
| 185 |
- if( FD_ISSET( dev_fd, &errFds ) ) |
|
| 204 |
+ if( dev_fd != -1 && FD_ISSET( dev_fd, &errFds ) ) |
|
| 186 | 205 |
{
|
| 206 |
+ if( *p_device_output_active ) |
|
| 187 | 207 |
printf( "error on device\n" ); |
| 188 | 208 |
break; |
| 189 | 209 |
} |
| ... | ... |
@@ -196,10 +216,10 @@ static void recv_and_out( int udpSocket, int dev_fd, |
| 196 | 216 |
if( len < 0 ) |
| 197 | 217 |
{
|
| 198 | 218 |
printf( "could not read from socket\n" ); |
| 199 |
- break; |
|
| 219 |
+ return -1; |
|
| 200 | 220 |
} |
| 201 | 221 |
if( len == 0 ) |
| 202 |
- break; |
|
| 222 |
+ return -1; |
|
| 203 | 223 |
|
| 204 | 224 |
//get frame from data |
| 205 | 225 |
pFrame = BlinkenFrameFromNetwork( buffer, len, NULL ); |
| ... | ... |
@@ -216,34 +236,171 @@ static void recv_and_out( int udpSocket, int dev_fd, |
| 216 | 236 |
BlinkenFrameFree( pFrame ); |
| 217 | 237 |
|
| 218 | 238 |
//output data to device |
| 219 |
- if( len > 0 ) |
|
| 220 |
- write( dev_fd, buffer, len ); |
|
| 239 |
+ if( dev_fd != -1 && len > 0 ) |
|
| 240 |
+ {
|
|
| 241 |
+ if( write( dev_fd, buffer, len ) != len ) |
|
| 242 |
+ {
|
|
| 243 |
+ if( *p_device_output_active ) |
|
| 244 |
+ printf( "error writing to device\n" ); |
|
| 245 |
+ break; |
|
| 246 |
+ } |
|
| 247 |
+ //message: output to device was restarted |
|
| 248 |
+ if( ! *p_device_output_active ) |
|
| 249 |
+ printf( "restarted output to device...\n" ); |
|
| 250 |
+ *p_device_output_active = 1; |
|
| 251 |
+ } |
|
| 221 | 252 |
} |
| 222 | 253 |
} |
| 223 | 254 |
|
| 224 | 255 |
//received data from device |
| 225 |
- if( FD_ISSET( dev_fd, &readFds ) ) |
|
| 256 |
+ if( dev_fd != -1 && FD_ISSET( dev_fd, &readFds ) ) |
|
| 226 | 257 |
{
|
| 227 | 258 |
//read data |
| 228 | 259 |
len = read( dev_fd, buffer, sizeof( buffer ) ); |
| 229 | 260 |
if( len < 0 ) |
| 230 | 261 |
{
|
| 231 |
- printf( "error while reading from device\n" ); |
|
| 262 |
+ if( *p_device_output_active ) |
|
| 263 |
+ printf( "error reading from device\n" ); |
|
| 232 | 264 |
break; |
| 233 | 265 |
} |
| 234 | 266 |
if( len == 0 ) |
| 235 | 267 |
dev_eof = 1; |
| 236 | 268 |
} |
| 269 |
+ |
|
| 270 |
+ //using time limit |
|
| 271 |
+ if( use_msecs ) |
|
| 272 |
+ {
|
|
| 273 |
+ //get time elapsed |
|
| 274 |
+ gettimeofday( &end, NULL ); |
|
| 275 |
+ int sec, usec; |
|
| 276 |
+ unsigned int msec; |
|
| 277 |
+ sec = end.tv_sec - start.tv_sec; |
|
| 278 |
+ usec = end.tv_usec - start.tv_usec; |
|
| 279 |
+ if( usec < 0 ) |
|
| 280 |
+ {
|
|
| 281 |
+ usec += 1000000; |
|
| 282 |
+ sec--; |
|
| 283 |
+ } |
|
| 284 |
+ if( usec < 0 ) |
|
| 285 |
+ usec = 0; |
|
| 286 |
+ if( sec < 0 ) |
|
| 287 |
+ sec = 0; |
|
| 288 |
+ msec = sec * 1000 + usec / 1000; |
|
| 289 |
+ //more than rest of timeout (or exact match) |
|
| 290 |
+ if( msec >= msecs ) |
|
| 291 |
+ break; |
|
| 292 |
+ msecs -= msec; |
|
| 293 |
+ } |
|
| 294 |
+ |
|
| 237 | 295 |
} //for( ; ; ) |
| 296 |
+ |
|
| 297 |
+ return 0; |
|
| 298 |
+} |
|
| 299 |
+ |
|
| 300 |
+//open device and output frames |
|
| 301 |
+//returns error code (not for device-errors, 0 for success) |
|
| 302 |
+static int open_and_output( int udpSocket, char * device, |
|
| 303 |
+ int * p_device_output_active, |
|
| 304 |
+ int serial_settings_change, int serial_settings, |
|
| 305 |
+ unsigned int format_change, |
|
| 306 |
+ unsigned int format_height, unsigned int format_width, |
|
| 307 |
+ unsigned int format_channels, unsigned int format_colors, |
|
| 308 |
+ etBlinkenProto proto ) |
|
| 309 |
+{
|
|
| 310 |
+ int dev_fd, err; |
|
| 311 |
+ char txt[64]; |
|
| 312 |
+ |
|
| 313 |
+ //open device |
|
| 314 |
+ dev_fd = open( device, O_RDWR | O_NOCTTY | O_NONBLOCK ); |
|
| 315 |
+ if( dev_fd == -1 ) |
|
| 316 |
+ {
|
|
| 317 |
+ if( *p_device_output_active ) |
|
| 318 |
+ printf( "could not open \"%s\": error: %s\n", device, strerror( errno ) ); |
|
| 319 |
+ return 0; |
|
| 320 |
+ } |
|
| 321 |
+ |
|
| 322 |
+ //setup serial port |
|
| 323 |
+ if( serial_settings_change ) |
|
| 324 |
+ {
|
|
| 325 |
+ if( ! serial_settings_set( dev_fd, serial_settings ) ) |
|
| 326 |
+ {
|
|
| 327 |
+ if( *p_device_output_active ) |
|
| 328 |
+ {
|
|
| 329 |
+ serial_settings_to_str( serial_settings, txt, sizeof( txt ) ); |
|
| 330 |
+ printf( "could not set serial port to \"%s\"\n", txt ); |
|
| 331 |
+ } |
|
| 332 |
+ close( dev_fd ); |
|
| 333 |
+ return 0; |
|
| 334 |
+ } |
|
| 335 |
+ } |
|
| 336 |
+ |
|
| 337 |
+ //receive frames and output to device |
|
| 338 |
+ err = recv_and_out( udpSocket, dev_fd, p_device_output_active, |
|
| 339 |
+ format_change, format_height, format_width, format_channels, format_colors, |
|
| 340 |
+ proto, 0, 0 ); |
|
| 341 |
+ |
|
| 342 |
+ //close device |
|
| 343 |
+ close( dev_fd ); |
|
| 344 |
+ |
|
| 345 |
+ return err; |
|
| 346 |
+} |
|
| 347 |
+ |
|
| 348 |
+//open device and output frames in a loop |
|
| 349 |
+//returns error code (not for device-errors, 0 for success) |
|
| 350 |
+static int open_and_output_loop( int udpSocket, char * device, |
|
| 351 |
+ int serial_settings_change, int serial_settings, |
|
| 352 |
+ int reopen_device, unsigned int reopen_device_ms, |
|
| 353 |
+ unsigned int format_change, |
|
| 354 |
+ unsigned int format_height, unsigned int format_width, |
|
| 355 |
+ unsigned int format_channels, unsigned int format_colors, |
|
| 356 |
+ etBlinkenProto proto ) |
|
| 357 |
+{
|
|
| 358 |
+ int device_output_active, err; |
|
| 359 |
+ |
|
| 360 |
+ printf( "receiving frames and outputting them to \"%s\"...\n", device ); |
|
| 361 |
+ device_output_active = 1; |
|
| 362 |
+ |
|
| 363 |
+ for( ; ; ) |
|
| 364 |
+ {
|
|
| 365 |
+ |
|
| 366 |
+ //try to open device and output frames |
|
| 367 |
+ err = open_and_output( udpSocket, device, |
|
| 368 |
+ &device_output_active, |
|
| 369 |
+ serial_settings_change, serial_settings, |
|
| 370 |
+ format_change, format_height, format_width, format_channels, format_colors, |
|
| 371 |
+ proto ); |
|
| 372 |
+ if( err != 0 || ! reopen_device ) |
|
| 373 |
+ break; |
|
| 374 |
+ |
|
| 375 |
+ //output to device stopped |
|
| 376 |
+ if( device_output_active ) |
|
| 377 |
+ printf( "output to device stopped...\n" ); |
|
| 378 |
+ device_output_active = 0; |
|
| 379 |
+ |
|
| 380 |
+ //only fetch data from socket for a short time |
|
| 381 |
+ err = recv_and_out( udpSocket, -1, &device_output_active, |
|
| 382 |
+ format_change, format_height, format_width, format_channels, format_colors, |
|
| 383 |
+ proto, 1, reopen_device_ms ); |
|
| 384 |
+ if( err != 0 ) |
|
| 385 |
+ break;; |
|
| 386 |
+ |
|
| 387 |
+ } |
|
| 388 |
+ |
|
| 389 |
+ //output to device finshed |
|
| 390 |
+ if( device_output_active ) |
|
| 391 |
+ printf( "output to device finished...\n" ); |
|
| 392 |
+ device_output_active = 0; |
|
| 393 |
+ |
|
| 394 |
+ return err; |
|
| 238 | 395 |
} |
| 239 | 396 |
|
| 240 | 397 |
int main( int argCnt, char * * args ) |
| 241 | 398 |
{
|
| 242 |
- int i, udpSocket, bound, val, serial_settings, dev_fd; |
|
| 399 |
+ int i, udpSocket, bound, serial_settings; |
|
| 243 | 400 |
etBlinkenProto proto; |
| 244 | 401 |
unsigned int format_change, format_height, format_width, format_channels, format_colors; |
| 245 |
- unsigned int height, width, channels, colors; |
|
| 246 |
- unsigned int serial_settings_change; |
|
| 402 |
+ unsigned int height, width, channels, colors, reopen_device_ms; |
|
| 403 |
+ int serial_settings_change, reopen_device; |
|
| 247 | 404 |
char txt[64]; |
| 248 | 405 |
unsigned short port; |
| 249 | 406 |
struct sockaddr_in addr; |
| ... | ... |
@@ -251,7 +408,7 @@ int main( int argCnt, char * * args ) |
| 251 | 408 |
|
| 252 | 409 |
//print info |
| 253 | 410 |
printf( "BlinkenLib - BlinkenOutput\n" |
| 254 |
- "version 0.5 date 2005-12-06\n" |
|
| 411 |
+ "version 0.5.1 date 2005-12-14\n" |
|
| 255 | 412 |
"Copyright 2004-2005 Stefan Schuermans <1stein@schuermans.info>\n" |
| 256 | 413 |
"Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html\n" |
| 257 | 414 |
"a blinkenarea.org project\n\n" ); |
| ... | ... |
@@ -263,7 +420,7 @@ int main( int argCnt, char * * args ) |
| 263 | 420 |
"parameters:\n" |
| 264 | 421 |
" -l [<ip>:]<port>\n" |
| 265 | 422 |
" local address (defaults to 0.0.0.0:2323)\n" |
| 266 |
- " must occur before -r and -o, may only occur once\n" |
|
| 423 |
+ " must occur before -r, may only occur once\n" |
|
| 267 | 424 |
" -r <ip>[:<port>]\n" |
| 268 | 425 |
" remote addess (defaults to every remote address)\n" |
| 269 | 426 |
" -p [BLP|EBLP|MCUF]\n" |
| ... | ... |
@@ -273,7 +430,10 @@ int main( int argCnt, char * * args ) |
| 273 | 430 |
" -d <device>\n" |
| 274 | 431 |
" device to output frames to (defaults to \"/dev/null\")\n" |
| 275 | 432 |
" -s <baud-rate>,<parity>,<data-bits>,<stop-bits>\n" |
| 276 |
- " settings to use for serial devices (defaults to no change)\n\n", |
|
| 433 |
+ " settings to use for serial devices (defaults to no change)\n" |
|
| 434 |
+ " -o <milliseconds>\n" |
|
| 435 |
+ " reopen device after short time on error (defaults to not reopen)\n" |
|
| 436 |
+ "\n", |
|
| 277 | 437 |
args[0] ); |
| 278 | 438 |
return 0; |
| 279 | 439 |
} |
| ... | ... |
@@ -290,8 +450,13 @@ int main( int argCnt, char * * args ) |
| 290 | 450 |
//process parameters |
| 291 | 451 |
proto = BlinkenProtoMcuf; |
| 292 | 452 |
format_change = 0; |
| 453 |
+ format_height = 0; |
|
| 454 |
+ format_width = 0; |
|
| 455 |
+ format_channels = 0; |
|
| 456 |
+ format_colors = 0; |
|
| 293 | 457 |
device = "/dev/null"; |
| 294 | 458 |
serial_settings_change = 0; |
| 459 |
+ reopen_device = 0; |
|
| 295 | 460 |
for( i = 1; i < argCnt; i++ ) |
| 296 | 461 |
{
|
| 297 | 462 |
|
| ... | ... |
@@ -428,6 +593,21 @@ int main( int argCnt, char * * args ) |
| 428 | 593 |
printf( "missing serial settings for \"-s\"\n" ); |
| 429 | 594 |
} |
| 430 | 595 |
|
| 596 |
+ //reopen device on error after some time |
|
| 597 |
+ else if( strcmp( args[i], "-o" ) == 0 ) |
|
| 598 |
+ {
|
|
| 599 |
+ if( i + 1 < argCnt ) |
|
| 600 |
+ {
|
|
| 601 |
+ i++; |
|
| 602 |
+ if( sscanf( args[i], "%u", &reopen_device_ms ) == 1 && reopen_device_ms >= 1 ) |
|
| 603 |
+ reopen_device = 1; |
|
| 604 |
+ else |
|
| 605 |
+ printf( "invalid number of milliseconds \"%s\"\n", args[i] ); |
|
| 606 |
+ } |
|
| 607 |
+ else |
|
| 608 |
+ printf( "missing time for \"-o\"\n" ); |
|
| 609 |
+ } |
|
| 610 |
+ |
|
| 431 | 611 |
//unknown parameter |
| 432 | 612 |
else |
| 433 | 613 |
printf( "unknown parameter \"%s\", call without parameters to get help\n", args[i] ); |
| ... | ... |
@@ -452,36 +632,14 @@ int main( int argCnt, char * * args ) |
| 452 | 632 |
} |
| 453 | 633 |
} |
| 454 | 634 |
|
| 455 |
- //open device |
|
| 456 |
- dev_fd = open( device, O_RDWR | O_NOCTTY | O_NONBLOCK ); |
|
| 457 |
- if( dev_fd == -1 ) |
|
| 458 |
- {
|
|
| 459 |
- printf( "could not open \"%s\": error: %s\n", device, strerror( errno ) ); |
|
| 460 |
- close( udpSocket ); |
|
| 461 |
- return -1; |
|
| 462 |
- } |
|
| 463 |
- |
|
| 464 |
- //setup serial port |
|
| 465 |
- if( serial_settings_change ) |
|
| 466 |
- {
|
|
| 467 |
- if( ! serial_settings_set( dev_fd, serial_settings ) ) |
|
| 468 |
- {
|
|
| 469 |
- serial_settings_to_str( serial_settings, txt, sizeof( txt ) ); |
|
| 470 |
- printf( "could not set serial port to \"%s\"\n", txt ); |
|
| 471 |
- close( dev_fd ); |
|
| 472 |
- close( udpSocket ); |
|
| 473 |
- return -1; |
|
| 474 |
- } |
|
| 475 |
- } |
|
| 476 |
- |
|
| 477 |
- //recieve frames and output to device |
|
| 478 |
- printf( "receiving frames and outputting them to \"%s\"...\n", device ); |
|
| 479 |
- recv_and_out( udpSocket, dev_fd, |
|
| 635 |
+ //open device and output frames in a loop |
|
| 636 |
+ open_and_output_loop( udpSocket, device, |
|
| 637 |
+ serial_settings_change, serial_settings, |
|
| 638 |
+ reopen_device, reopen_device_ms, |
|
| 480 | 639 |
format_change, format_height, format_width, format_channels, format_colors, |
| 481 | 640 |
proto ); |
| 482 | 641 |
|
| 483 |
- //cleanup |
|
| 484 |
- close( dev_fd ); |
|
| 642 |
+ //close socket |
|
| 485 | 643 |
close( udpSocket ); |
| 486 | 644 |
|
| 487 | 645 |
return 0; |
| ... | ... |
@@ -1,5 +1,5 @@ |
| 1 | 1 |
/* BlinkenLib |
| 2 |
- * version 0.5 date 2005-12-06 |
|
| 2 |
+ * version 0.5.1 date 2005-12-14 |
|
| 3 | 3 |
* Copyright 2004-2005 Stefan Schuermans <1stein@schuermans.info> |
| 4 | 4 |
* Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html |
| 5 | 5 |
* a blinkenarea.org project |
| ... | ... |
@@ -8,6 +8,7 @@ |
| 8 | 8 |
#include <stdio.h> |
| 9 | 9 |
#include <stdlib.h> |
| 10 | 10 |
#include <string.h> |
| 11 |
+#include <unistd.h> |
|
| 11 | 12 |
#include <sys/types.h> |
| 12 | 13 |
#include <sys/socket.h> |
| 13 | 14 |
#include <netinet/in.h> |
| ... | ... |
@@ -25,7 +26,7 @@ int main( int argCnt, char * * args ) |
| 25 | 26 |
|
| 26 | 27 |
//print info |
| 27 | 28 |
printf( "BlinkenLib - BlinkenRecv\n" |
| 28 |
- "version 0.5 date 2005-12-06\n" |
|
| 29 |
+ "version 0.5.1 date 2005-12-14\n" |
|
| 29 | 30 |
"Copyright 2004-2005 Stefan Schuermans <1stein@schuermans.info>\n" |
| 30 | 31 |
"Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html\n" |
| 31 | 32 |
"a blinkenarea.org project\n\n" ); |
| ... | ... |
@@ -130,7 +131,7 @@ int main( int argCnt, char * * args ) |
| 130 | 131 |
if( i + 1 < argCnt ) |
| 131 | 132 |
{
|
| 132 | 133 |
i++; |
| 133 |
- if( sscanf( args[i], "%hu", &val ) == 1 ) |
|
| 134 |
+ if( sscanf( args[i], "%u", &val ) == 1 ) |
|
| 134 | 135 |
timeout = val; |
| 135 | 136 |
else |
| 136 | 137 |
printf( "invalid timeout value \"%s\"\n", args[i] ); |
| ... | ... |
@@ -1,5 +1,5 @@ |
| 1 | 1 |
/* BlinkenLib |
| 2 |
- * version 0.5 date 2005-12-06 |
|
| 2 |
+ * version 0.5.1 date 2005-12-14 |
|
| 3 | 3 |
* Copyright 2004-2005 Stefan Schuermans <1stein@schuermans.info> |
| 4 | 4 |
* Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html |
| 5 | 5 |
* a blinkenarea.org project |
| ... | ... |
@@ -8,6 +8,7 @@ |
| 8 | 8 |
#include <stdio.h> |
| 9 | 9 |
#include <stdlib.h> |
| 10 | 10 |
#include <string.h> |
| 11 |
+#include <unistd.h> |
|
| 11 | 12 |
#include <sys/types.h> |
| 12 | 13 |
#include <sys/socket.h> |
| 13 | 14 |
#include <netinet/in.h> |
| ... | ... |
@@ -27,7 +28,7 @@ int main( int argCnt, char * * args ) |
| 27 | 28 |
|
| 28 | 29 |
//print info |
| 29 | 30 |
printf( "BlinkenLib - BlinkenSend\n" |
| 30 |
- "version 0.5 date 2005-12-06\n" |
|
| 31 |
+ "version 0.5.1 date 2005-12-14\n" |
|
| 31 | 32 |
"Copyright 2004-2005 Stefan Schuermans <1stein@schuermans.info>\n" |
| 32 | 33 |
"Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html\n" |
| 33 | 34 |
"a blinkenarea.org project\n\n" ); |
| ... | ... |
@@ -1,5 +1,5 @@ |
| 1 | 1 |
# BlinkenLib |
| 2 |
-# version 0.5 date 2005-12-06 |
|
| 2 |
+# version 0.5.1 date 2005-12-14 |
|
| 3 | 3 |
# Copyright 2004-2005 Stefan Schuermans <1stein@schuermans.info> |
| 4 | 4 |
# Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html |
| 5 | 5 |
# a blinkenarea.org project |
| ... | ... |
@@ -28,17 +28,29 @@ BlinkenLib.a: BlinkenFrame.o BlinkenMovie.o Tools.o |
| 28 | 28 |
$(AR) $(ARFLAGS) BlinkenLib.a BlinkenFrame.o BlinkenMovie.o Tools.o |
| 29 | 29 |
$(RANLIB) BlinkenLib.a |
| 30 | 30 |
|
| 31 |
-BlinkenConv: BlinkenConv.c BlinkenLib.h BlinkenLib.a |
|
| 32 |
- $(CC) $(LFLAGS) -o BlinkenConv BlinkenConv.c BlinkenLib.a |
|
| 31 |
+BlinkenConv.o: BlinkenConv.c BlinkenLib.h |
|
| 32 |
+ $(CC) $(CFLAGS) -c -o BlinkenConv.o BlinkenConv.c |
|
| 33 | 33 |
|
| 34 |
-BlinkenSend: BlinkenSend.c BlinkenLib.h BlinkenLib.a |
|
| 35 |
- $(CC) $(LFLAGS) -o BlinkenSend BlinkenSend.c BlinkenLib.a |
|
| 34 |
+BlinkenConv: BlinkenConv.o BlinkenLib.a |
|
| 35 |
+ $(CC) $(LFLAGS) -o BlinkenConv BlinkenConv.o BlinkenLib.a |
|
| 36 | 36 |
|
| 37 |
-BlinkenRecv: BlinkenRecv.c BlinkenLib.h BlinkenLib.a |
|
| 38 |
- $(CC) $(LFLAGS) -o BlinkenRecv BlinkenRecv.c BlinkenLib.a |
|
| 37 |
+BlinkenSend.o: BlinkenSend.c BlinkenLib.h |
|
| 38 |
+ $(CC) $(CFLAGS) -c -o BlinkenSend.o BlinkenSend.c |
|
| 39 | 39 |
|
| 40 |
-BlinkenOutput: BlinkenOutput.c BlinkenLib.h BlinkenLib.a |
|
| 41 |
- $(CC) $(LFLAGS) -o BlinkenOutput BlinkenOutput.c BlinkenLib.a |
|
| 40 |
+BlinkenSend: BlinkenSend.o BlinkenLib.a |
|
| 41 |
+ $(CC) $(LFLAGS) -o BlinkenSend BlinkenSend.o BlinkenLib.a |
|
| 42 |
+ |
|
| 43 |
+BlinkenRecv.o: BlinkenRecv.c BlinkenLib.h |
|
| 44 |
+ $(CC) $(CFLAGS) -c -o BlinkenRecv.o BlinkenRecv.c |
|
| 45 |
+ |
|
| 46 |
+BlinkenRecv: BlinkenRecv.o BlinkenLib.a |
|
| 47 |
+ $(CC) $(LFLAGS) -o BlinkenRecv BlinkenRecv.o BlinkenLib.a |
|
| 48 |
+ |
|
| 49 |
+BlinkenOutput.o: BlinkenOutput.c BlinkenLib.h |
|
| 50 |
+ $(CC) $(CFLAGS) -c -o BlinkenOutput.o BlinkenOutput.c |
|
| 51 |
+ |
|
| 52 |
+BlinkenOutput: BlinkenOutput.o BlinkenLib.a |
|
| 53 |
+ $(CC) $(LFLAGS) -o BlinkenOutput BlinkenOutput.o BlinkenLib.a |
|
| 42 | 54 |
|
| 43 | 55 |
clean: |
| 44 | 56 |
rm -f *.o BlinkenLib.a BlinkenConv BlinkenSend BlinkenRecv BlinkenOutput |