Hi,

Here is a patch to use the ID switch setting of the EK1101 instead of the nominal alias register, when '--enable-regalias' is specified to configure. An objection to this patch is the hard-coding of the vendor and product code. A whitelist approach would probably be better.

        - Dave Page


diff -r 51ad16e57f8f master/fsm_slave_scan.c
--- a/master/fsm_slave_scan.c   Tue Dec 10 10:43:13 2013 +0100
+++ b/master/fsm_slave_scan.c   Tue Jan 07 21:37:20 2014 -0500
@@ -816,9 +816,13 @@
     ec_datagram_t *datagram = fsm->datagram;
     ec_slave_t *slave = fsm->slave;

+    // choose switch register when slave is EK1101
+    uint16_t reg_addr = slave->sii.vendor_id == 0x2 &&
+        slave->sii.product_code == 0x044d2c52 ? 0x1000 : 0x0012;
+
     // read alias from register
     EC_SLAVE_DBG(slave, 1, "Reading alias from register.\n");
-    ec_datagram_fprd(datagram, slave->station_address, 0x0012, 2);
+    ec_datagram_fprd(datagram, slave->station_address, reg_addr, 2);
     ec_datagram_zero(datagram);
     fsm->retries = EC_FSM_RETRIES;
     fsm->state = ec_fsm_slave_scan_state_regalias;

<<attachment: dave_page.vcf>>

_______________________________________________
etherlab-dev mailing list
etherlab-dev@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-dev

Reply via email to