[riot-users] CC110x interface issue

Sichen Zhao zsc19940506 at outlook.com
Wed Nov 22 04:46:30 CET 2017


Hi,

i use a cc1101 module to connect with nucleo-144 f429, when i test the example of ccn-lite-relay, it came out an error:

error: unable to determine address length for if=<3>
Error registering at network interface!

The error cames from: ccn-lite-riot.c

res = gnrc_netapi_get(if_pid, NETOPT_ADDR_LEN, 0, &(i->addr_len), sizeof(i->addr_len));
    if (res < 0) {
        DEBUGMSG(ERROR, "error: unable to determine address length for if=<%u>\n", (unsigned) if_pid);
        return -ECANCELED;
    }

In the file of cc110x-netdev.c, the _get function doesn't have the case for NETOPT_ADDR_LEN:

static int _get(netdev_t *dev, netopt_t opt, void *value, size_t value_len)
{printf("_get\n");
    cc110x_t *cc110x = &((netdev_cc110x_t*) dev)->cc110x;

    switch (opt) {
        case NETOPT_DEVICE_TYPE:
            assert(value_len == 2);
            *((uint16_t *) value) = NETDEV_TYPE_CC110X;
            return 2;
#ifdef MODULE_GNRC_NETIF
        case NETOPT_PROTO:
            assert(value_len == sizeof(gnrc_nettype_t));
            *((gnrc_nettype_t *)value) = cc110x->proto;
            return sizeof(gnrc_nettype_t);
#endif
        case NETOPT_CHANNEL:
            assert(value_len > 1);
            *((uint16_t *)value) = (uint16_t)cc110x->radio_channel;
            return 2;
        case NETOPT_ADDRESS:
            assert(value_len > 0);
            *((uint8_t *)value) = cc110x->radio_address;
            return 1;
        case NETOPT_MAX_PACKET_SIZE:
        printf("NETOPT_MAX_PACKET_SIZE\n");
            assert(value_len > 0);
            *((uint8_t *)value) = CC110X_PACKET_LENGTH;
            return 1;
        case NETOPT_IPV6_IID:
            return _get_iid(dev, value, value_len);
        default:
            break;
    }

    return -ENOTSUP;
}

So how to fix it?

Best Regards
Sichen Zhao


More information about the users mailing list