summaryrefslogtreecommitdiff
path: root/switch.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2013-10-17 12:50:17 +0200
committerFelix Fietkau <nbd@nbd.name>2016-07-19 14:22:14 +0200
commit8a47c4b6649f8437bb60300471400d558426612e (patch)
tree6f8bf18178da42682af427938db1076683d37c01 /switch.c
parent993a9a542791953c4804f7ddbb3a07756738e37a (diff)
add TargetClass support
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Diffstat (limited to 'switch.c')
-rw-r--r--switch.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/switch.c b/switch.c
index 2c33d9c..b283561 100644
--- a/switch.c
+++ b/switch.c
@@ -11,6 +11,7 @@ enum {
DATA_RELEASE_DELAY,
DATA_CONFIG,
DATA_ALT,
+ DATA_DEV_CLASS,
__DATA_MAX
};
@@ -410,12 +411,17 @@ void handle_switch(struct usbdev_data *data)
[DATA_RESPONSE] = { .name = "response", .type = BLOBMSG_TYPE_BOOL },
[DATA_CONFIG] = { .name = "config", .type = BLOBMSG_TYPE_INT32 },
[DATA_ALT] = { .name = "alt", .type = BLOBMSG_TYPE_INT32 },
+ [DATA_DEV_CLASS] = { .name = "t_class", .type = BLOBMSG_TYPE_INT32 },
};
struct blob_attr *tb[__DATA_MAX];
int mode = MODE_GENERIC;
+ int t_class = 0;
blobmsg_parse(data_policy, __DATA_MAX, tb, blobmsg_data(data->info), blobmsg_data_len(data->info));
+ if (tb[DATA_DEV_CLASS])
+ t_class = blobmsg_get_u32(tb[DATA_DEV_CLASS]);
+
if (tb[DATA_INTERFACE])
data->interface = blobmsg_get_u32(tb[DATA_INTERFACE]);
@@ -431,6 +437,9 @@ void handle_switch(struct usbdev_data *data)
if (tb[DATA_RESPONSE])
data->need_response = blobmsg_get_bool(tb[DATA_RESPONSE]);
+ if (t_class > 0 && data->dev_class != t_class)
+ return;
+
if (tb[DATA_MODE]) {
const char *modestr;
int i;