1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

Merge pull request #6373 from miri64/cc110x/fix/proto-only-for-gnrc_netif

cc110x: only handle NETOPT_PROTO if gnrc_netif module is present
This commit is contained in:
Peter Kietzmann 2017-01-18 10:04:24 +01:00 committed by GitHub
commit 322de6627f

View File

@ -95,10 +95,12 @@ static int _get(netdev2_t *dev, netopt_t opt, void *value, size_t value_len)
assert(value_len == 2); assert(value_len == 2);
*((uint16_t *) value) = NETDEV2_TYPE_CC110X; *((uint16_t *) value) = NETDEV2_TYPE_CC110X;
return 2; return 2;
#ifdef MODULE_GNRC_NETIF
case NETOPT_PROTO: case NETOPT_PROTO:
assert(value_len == sizeof(gnrc_nettype_t)); assert(value_len == sizeof(gnrc_nettype_t));
*((gnrc_nettype_t *)value) = cc110x->proto; *((gnrc_nettype_t *)value) = cc110x->proto;
return sizeof(gnrc_nettype_t); return sizeof(gnrc_nettype_t);
#endif
case NETOPT_CHANNEL: case NETOPT_CHANNEL:
assert(value_len > 1); assert(value_len > 1);
*((uint16_t *)value) = (uint16_t)cc110x->radio_channel; *((uint16_t *)value) = (uint16_t)cc110x->radio_channel;
@ -145,6 +147,7 @@ static int _set(netdev2_t *dev, netopt_t opt, void *value, size_t value_len)
return -EINVAL; return -EINVAL;
} }
return 1; return 1;
#ifdef MODULE_GNRC_NETIF
case NETOPT_PROTO: case NETOPT_PROTO:
if (value_len != sizeof(gnrc_nettype_t)) { if (value_len != sizeof(gnrc_nettype_t)) {
return -EINVAL; return -EINVAL;
@ -154,6 +157,7 @@ static int _set(netdev2_t *dev, netopt_t opt, void *value, size_t value_len)
return sizeof(gnrc_nettype_t); return sizeof(gnrc_nettype_t);
} }
break; break;
#endif
default: default:
return -ENOTSUP; return -ENOTSUP;
} }