Implemented SoE write state machine and soe_write command.

This commit is contained in:
Florian Pose
2010-03-05 15:32:56 +01:00
parent 3c1cf99c44
commit ffca1fa780
12 changed files with 552 additions and 48 deletions

View File

@@ -528,7 +528,7 @@ void MasterDevice::getEoeHandler(
/****************************************************************************/
void MasterDevice::readSoe(ec_ioctl_slave_soe_t *data)
void MasterDevice::readSoe(ec_ioctl_slave_soe_read_t *data)
{
if (ioctl(fd, EC_IOCTL_SLAVE_SOE_READ, data) < 0) {
if (errno == EIO && data->error_code) {
@@ -541,4 +541,19 @@ void MasterDevice::readSoe(ec_ioctl_slave_soe_t *data)
}
}
/****************************************************************************/
void MasterDevice::writeSoe(ec_ioctl_slave_soe_write_t *data)
{
if (ioctl(fd, EC_IOCTL_SLAVE_SOE_WRITE, data) < 0) {
if (errno == EIO && data->error_code) {
throw MasterDeviceSoeException(data->error_code);
} else {
stringstream err;
err << "Failed to write IDN: " << strerror(errno);
throw MasterDeviceException(err);
}
}
}
/*****************************************************************************/