diff options
author | Harald Welte <laforge@osmocom.org> | 2020-01-11 17:33:08 +0100 |
---|---|---|
committer | Harald Welte <laforge@osmocom.org> | 2021-06-06 11:46:50 +0200 |
commit | 9292d22726387dba024c2b0c9d76498546f291a1 (patch) | |
tree | fb6460e9f540483614b80abba42e1d30e83a3d8a | |
parent | d2bc858ddf0d404ce05a46cadbe86010647816ea (diff) |
WIP: firmware: sniffer: inbound USB handling
Change-Id: Ic953148600d82285281abcb573a07e2e9b8082a7
-rw-r--r-- | firmware/libcommon/source/sniffer.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/firmware/libcommon/source/sniffer.c b/firmware/libcommon/source/sniffer.c index 7917bd8..3f89866 100644 --- a/firmware/libcommon/source/sniffer.c +++ b/firmware/libcommon/source/sniffer.c @@ -978,8 +978,22 @@ static void usb_send_change(uint32_t flags) /* handle incoming message from USB OUT EP */ static void dispatch_usb_out(struct msgb *msg, const struct usb_if *usb_if) { - /* currently we don't need any incoming data */ - msgb_free(msg); + struct simtrace_msg_hdr *sh = (struct simtrace_msg_hdr *) msg->l1h; + + if (msgb_length(msg) < sizeof(*sh)) { + usb_buf_free(msg); + return; + } + msg->l2h = msg->l1h + sizeof(*sh); + + switch (sh->msg_class) { + case SIMTRACE_MSGC_GENERIC: + break; + default: + break; + } + + usb_buf_free(msg); } static const struct usb_if sniffer_usb_if = { |