#include "switch.h"
+enum {
+ DATA_MODE,
+ DATA_MSG,
+ DATA_INTERFACE,
+ __DATA_MAX
+};
+
static void handle_generic(struct usbdev_data *data, struct blob_attr **tb)
{
fprintf(stderr, "Do generic switch!\n");
static const struct blobmsg_policy data_policy[__DATA_MAX] = {
[DATA_MODE] = { .name = "mode", .type = BLOBMSG_TYPE_STRING },
[DATA_MSG] = { .name = "msg", .type = BLOBMSG_TYPE_ARRAY },
+ [DATA_INTERFACE] = { .name = "interface", .type = BLOBMSG_TYPE_INT32 },
};
struct blob_attr *tb[__DATA_MAX];
int mode = MODE_GENERIC;
blobmsg_parse(data_policy, __DATA_MAX, tb, blobmsg_data(data->info), blobmsg_data_len(data->info));
+ if (tb[DATA_INTERFACE])
+ data->interface = blobmsg_get_u32(tb[DATA_INTERFACE]);
+
if (tb[DATA_MODE]) {
const char *modestr;
int i;
char mfg[128], prod[128], serial[128];
};
-enum {
- DATA_MODE,
- DATA_MSG,
- DATA_MSG2,
- DATA_MSG3,
- __DATA_MAX
-};
-
void handle_switch(struct usbdev_data *data);
#endif