Changeset 1700 for trunk

Show
Ignore:
Timestamp:
11/03/09 13:08:56 (14 years ago)
Author:
arnonym
Message:

Use the libraw1394 in the correct way by only checking errno if an error actually occured.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libffado/tests/systemtests/test-isorecv-1.cpp

    r1234 r1700  
    189189 
    190190    debugOutput(DEBUG_LEVEL_INFO, "Select 1394 port %d...\n", arguments.port); 
     191    int ret = -1; 
    191192    do 
    192193    { 
     
    196197            return 1; 
    197198        } 
    198         raw1394_set_port(handle, arguments.port); 
    199     } while (errno == ESTALE); 
    200  
    201     if(errno) 
     199        ret = raw1394_set_port(handle, arguments.port); 
     200    } while (ret != 0 && errno == ESTALE); 
     201 
     202    if(ret != 0 && errno) 
    202203    { 
    203204        perror("raw1394_set_port"); 
  • trunk/libffado/tests/systemtests/test-isoxmit-1.cpp

    r1146 r1700  
    161161 
    162162    //debugOutput(DEBUG_LEVEL_INFO, "In handler\n"); 
    163     //sprintf((char *)data, "Hello World %8u\n", count); 
     163    sprintf((char *)data, "Hello World %8u\n", count); 
    164164    if (last_cycle >= 0) { 
    165165        if (cycle != (last_cycle + 1) % 8000) { 
     
    180180void prepareXmit(raw1394handle_t handle) 
    181181{ 
     182    debugOutput(DEBUG_LEVEL_INFO, "prepareXmit(handle)\n"); 
    182183    if(raw1394_iso_xmit_init(handle, 
    183184                myISOSender, 
     
    244245 
    245246    debugOutput(DEBUG_LEVEL_INFO, "Select 1394 port %d...\n", arguments.port); 
     247    int ret = -1; 
    246248    do 
    247249    { 
     
    251253            return 1; 
    252254        } 
    253         raw1394_set_port(handle, arguments.port ); 
    254     } while (errno == ESTALE); 
    255  
    256     if(errno) 
     255        ret = raw1394_set_port(handle, arguments.port ); 
     256    } while (ret != 0 && errno == ESTALE); 
     257 
     258    if(ret != 0 && errno) 
    257259    { 
    258260        perror("raw1394_set_port"); 
     
    260262    } 
    261263 
     264    if(raw1394_busreset_notify(handle, RAW1394_NOTIFY_ON)) 
     265    { 
     266        perror("raw1394_busreset_notify"); 
     267        exit(1); 
     268    } 
     269    raw1394_set_bus_reset_handler(handle, myResetHandler); 
     270 
     271    debugOutput(DEBUG_LEVEL_INFO, "Setting RT priority (%d)...\n", arguments.rtprio); 
     272    set_realtime_priority(arguments.rtprio); 
     273 
    262274    debugOutput(DEBUG_LEVEL_INFO, "Prepare/start ISO transmit...\n"); 
    263275    prepareXmit(handle); 
    264  
    265     if(raw1394_busreset_notify(handle, RAW1394_NOTIFY_ON)) 
    266     { 
    267         perror("raw1394_busreset_notify"); 
    268         exit(1); 
    269     } 
    270     raw1394_set_bus_reset_handler(handle, myResetHandler); 
    271  
    272     debugOutput(DEBUG_LEVEL_INFO, "Setting RT priority (%d)...\n", arguments.rtprio); 
    273     set_realtime_priority(arguments.rtprio); 
    274276 
    275277    int countdown = arguments.countdown;