This patch puts the page and channel setting in one cmd. These parameters depends on each other and should be set in one cmd. Signed-off-by: Alexander Aring <alex.aring@xxxxxxxxx> --- src/phy.c | 40 ++++++++++------------------------------ 1 file changed, 10 insertions(+), 30 deletions(-) diff --git a/src/phy.c b/src/phy.c index e57ad6a..8379786 100644 --- a/src/phy.c +++ b/src/phy.c @@ -13,33 +13,6 @@ #include "nl802154.h" #include "iwpan.h" -static int handle_page_set(struct nl802154_state *state, - struct nl_cb *cb, - struct nl_msg *msg, - int argc, char **argv, - enum id_input id) -{ - unsigned long page; - char *end; - - if (argc < 1) - return 1; - - /* PAGE */ - page = strtoul(argv[0], &end, 10); - if (*end != '\0') - return 1; - - NLA_PUT_U8(msg, NL802154_ATTR_PAGE, page); - - return 0; - -nla_put_failure: - return -ENOBUFS; -} -COMMAND(set, page, "<page>", - NL802154_CMD_SET_PAGE, 0, CIB_PHY, handle_page_set, NULL); - static int handle_channel_set(struct nl802154_state *state, struct nl_cb *cb, struct nl_msg *msg, @@ -47,16 +20,23 @@ static int handle_channel_set(struct nl802154_state *state, enum id_input id) { unsigned long channel; + unsigned long page; char *end; - if (argc < 1) + if (argc < 2) + return 1; + + /* PAGE */ + page = strtoul(argv[0], &end, 10); + if (*end != '\0') return 1; /* CHANNEL */ - channel = strtoul(argv[0], &end, 10); + channel = strtoul(argv[1], &end, 10); if (*end != '\0') return 1; + NLA_PUT_U8(msg, NL802154_ATTR_PAGE, page); NLA_PUT_U8(msg, NL802154_ATTR_CHANNEL, channel); return 0; @@ -64,7 +44,7 @@ static int handle_channel_set(struct nl802154_state *state, nla_put_failure: return -ENOBUFS; } -COMMAND(set, channel, "<channel>", +COMMAND(set, channel, "<page> <channel>", NL802154_CMD_SET_CHANNEL, 0, CIB_PHY, handle_channel_set, NULL); static int handle_tx_power_set(struct nl802154_state *state, -- 2.1.3 -- To unsubscribe from this list: send the line "unsubscribe linux-wpan" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html