Ignore:
Timestamp:
04/12/02 16:59:23 (22 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Cosy/candrv
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Cosy/candrv/canopen.cc

    r1266 r1275  
    6767            pthread_mutex_destroy(&fPdoMux[i][j]);
    6868        }
     69    lout << "- CanOpen destroyed." << endl;
    6970}
    7071
  • trunk/MagicSoft/Cosy/candrv/vmodican.cc

    r1273 r1275  
    3838#include <errno.h>         // errno
    3939#include <unistd.h>        // read
    40 #include <pthread.h>       // pthread_create
    4140#include <sys/time.h>      // gettimeofday
    4241#include <sys/ioctl.h>     // ioctl
    43 #include <sys/resource.h>  // PRIO_PROCESS
    4442
    4543ClassImp(VmodIcan);
     
    110108    while (1)
    111109    {
     110        //
     111        // Sleeps until a message arrives
     112        //
    112113        unsigned char c;
     114        const int n = read(fd, &c, 1);
     115
     116        if (n<0)
     117        {
     118            cerr << "Vmodican: read(" << dec << (int)fd << "," << (void*)&c;
     119            cerr << ",1) returned c=" << (int)c << " '" << strerror(errno);
     120            cerr << "' (errno = " << errno << ")" << endl;
     121            continue;
     122            //return (void *)1;
     123        }
     124
     125        //
     126        // read the time for the message as soon as possible
     127        //
    113128        timeval_t tv;
    114 
    115         //
    116         // Sleeps until a message arrives
    117         //
    118         const int n = read(fd, &c, 1);
    119 
    120         //
    121         // read the time for the message as soon as possible
    122         //
    123129        gettimeofday(&tv, NULL);
    124130
     
    128134        if (n == 0)
    129135        {
    130             cerr << "panic read (errno=" << errno << ") ..." << endl;
     136            cerr << "Vmodican: Panic read '" << strerror(errno) << "' ";
     137            cerr << "(errno=" << errno << ")" << endl;
    131138            return (void *)1;
    132139        }
     
    155162
    156163            cout << endl;
    157             break;
     164            continue;
    158165
    159166        //
     
    171178
    172179            HandleMessage(&msg, &tv);
    173 
    174             break;
     180            continue;
    175181        }
     182
     183        cout << "Vmodican: read, Message c=" << (int)c << " unknown." << endl;
    176184    }
    177185    return NULL;
     
    495503void VmodIcan::DisableCanBusConnection()
    496504{
    497     lout << "- Disconnect from Bus!" << endl;
     505    lout << "- Disconnect VmodIcan module from Bus!" << endl;
    498506
    499507    Message msg;                  /* buffer for module messages */
     
    503511
    504512    while (!Send(&msg));
     513
     514    lout << "- VmodIcan disconnected." << endl;
    505515}
    506516
     
    529539void VmodIcan::Close()
    530540{
    531     lout << "- Close Device!" << endl;
     541    lout << "- Closing device VmodIcan #" << (int)fd << endl;
    532542
    533543    Message msg; /* disconnect message */
     
    539549
    540550    close(fd);
     551
     552    lout << "- Device closed." << endl;
    541553}
    542554
     
    950962VmodIcan::~VmodIcan()
    951963{
     964    lout << "- Stopping VmodIcan module." << endl;
    952965    Stop();
    953966    DisableCanBusConnection();
    954967    Close();
     968    lout << "- VmodIcan stopped." << endl;
    955969}
    956970
Note: See TracChangeset for help on using the changeset viewer.