310 uint8_t subindex, const uint8_t *data, size_t size) |
310 uint8_t subindex, const uint8_t *data, size_t size) |
311 { |
311 { |
312 ec_slave_t *slave = sc->slave; |
312 ec_slave_t *slave = sc->slave; |
313 ec_sdo_data_t *sdodata; |
313 ec_sdo_data_t *sdodata; |
314 |
314 |
315 if (slave && !(slave->sii_mailbox_protocols & EC_MBOX_COE)) { |
315 if (slave && !(slave->sii.mailbox_protocols & EC_MBOX_COE)) { |
316 EC_ERR("Slave %u does not support CoE!\n", slave->ring_position); |
316 EC_ERR("Slave %u does not support CoE!\n", slave->ring_position); |
317 return -1; |
317 return -1; |
318 } |
318 } |
319 |
319 |
320 if (!(sdodata = (ec_sdo_data_t *) |
320 if (!(sdodata = (ec_sdo_data_t *) |
357 if (sc->slave) |
357 if (sc->slave) |
358 return 0; // already attached |
358 return 0; // already attached |
359 |
359 |
360 list_for_each_entry(slave, &sc->master->slaves, list) { |
360 list_for_each_entry(slave, &sc->master->slaves, list) { |
361 if (!alias_found) { |
361 if (!alias_found) { |
362 if (sc->alias && slave->sii_alias != sc->alias) |
362 if (sc->alias && slave->sii.alias != sc->alias) |
363 continue; |
363 continue; |
364 alias_found = 1; |
364 alias_found = 1; |
365 relative_position = 0; |
365 relative_position = 0; |
366 } |
366 } |
367 if (relative_position == sc->position) |
367 if (relative_position == sc->position) |
378 EC_ERR("Failed to attach slave configuration %u:%u. Slave %u" |
378 EC_ERR("Failed to attach slave configuration %u:%u. Slave %u" |
379 " already has a configuration!\n", sc->alias, |
379 " already has a configuration!\n", sc->alias, |
380 sc->position, slave->ring_position); |
380 sc->position, slave->ring_position); |
381 return -2; |
381 return -2; |
382 } |
382 } |
383 if (slave->sii_vendor_id != sc->vendor_id |
383 if (slave->sii.vendor_id != sc->vendor_id |
384 || slave->sii_product_code != sc->product_code) { |
384 || slave->sii.product_code != sc->product_code) { |
385 EC_ERR("Slave %u has an invalid type (0x%08X/0x%08X) for" |
385 EC_ERR("Slave %u has an invalid type (0x%08X/0x%08X) for" |
386 " configuration %u:%u (0x%08X/0x%08X).\n", |
386 " configuration %u:%u (0x%08X/0x%08X).\n", |
387 slave->ring_position, slave->sii_vendor_id, |
387 slave->ring_position, slave->sii.vendor_id, |
388 slave->sii_product_code, sc->alias, sc->position, |
388 slave->sii.product_code, sc->alias, sc->position, |
389 sc->vendor_id, sc->product_code); |
389 sc->vendor_id, sc->product_code); |
390 return -3; |
390 return -3; |
391 } |
391 } |
392 |
392 |
393 // attach slave |
393 // attach slave |