Changeset 133 in flair-src for trunk/lib/FlairCore/src/RTDM_I2cPort.cpp


Ignore:
Timestamp:
02/09/17 11:08:31 (5 years ago)
Author:
Sanahuja Guillaume
Message:

modif sterror

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/FlairCore/src/RTDM_I2cPort.cpp

    r15 r133  
    2121
    2222#include <rtdm/rti2c.h>
    23 #include <errno.h>
    2423#include <cstring>
    2524
     
    3736  fd = rt_dev_open(device.c_str(), 0);
    3837  if (fd < 0) {
    39     Err("rt_dev_open (%s)\n", ObjectName().c_str(), strerror(-fd));
     38                char errorMsg[256];
     39    Err("rt_dev_open (%s)\n", ObjectName().c_str(), strerror_r(-fd, errorMsg, sizeof(errorMsg)));
    4040  }
    4141
     
    5050  err = rt_dev_ioctl(fd, RTI2C_RTIOC_SET_CONFIG, &write_config);
    5151  if (err) {
     52                char errorMsg[256];
    5253    Err("rt_dev_ioctl RTI2C_RTIOC_SET_CONFIG error (%s)\n",
    53         ObjectName().c_str(), strerror(-err));
     54        ObjectName().c_str(), strerror_r(-err, errorMsg, sizeof(errorMsg)));
    5455  }
    5556}
     
    6061  int err = rt_dev_ioctl(fd, RTI2C_RTIOC_SET_SLAVE, &address);
    6162  if (err) {
    62     Err("rt_dev_ioctl RTI2C_RTIOC_SET_SLAVE error (%s)\n", strerror(-err));
     63                char errorMsg[256];
     64    Err("rt_dev_ioctl RTI2C_RTIOC_SET_SLAVE error (%s)\n", strerror_r(-err, errorMsg, sizeof(errorMsg)));
    6365  }
    6466
     
    7476  int err = rt_dev_ioctl(fd, RTI2C_RTIOC_SET_CONFIG, &write_config);
    7577  if (err) {
     78                char errorMsg[256];
    7679    Err("rt_dev_ioctl RTI2C_RTIOC_SET_CONFIG (%s)\n", ObjectName().c_str(),
    77         strerror(-err));
     80        strerror_r(-err, errorMsg, sizeof(errorMsg)));
    7881  }
    7982}
     
    8790  int err = rt_dev_ioctl(fd, RTI2C_RTIOC_SET_CONFIG, &write_config);
    8891  if (err) {
     92                char errorMsg[256];
    8993    Err("rt_dev_ioctl RTI2C_RTIOC_SET_CONFIG (%s)\n", ObjectName().c_str(),
    90         strerror(-err));
     94        strerror_r(-err, errorMsg, sizeof(errorMsg)));
    9195  }
    9296}
Note: See TracChangeset for help on using the changeset viewer.