diff options
author | Hans de Goede <hdegoede@redhat.com> | 2012-09-05 17:18:10 +0200 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2012-09-05 17:18:10 +0200 |
commit | 96c2666bcdca5fdf2680d25fe581a6c0919099da (patch) | |
tree | c0f236972d2310a37210bf744bd664c91d7e1e66 | |
parent | 75fb7bd480b8332a180380dc90b655bb1800f642 (diff) |
usbredirparser: Add a usbredirparser_fl_no_hello flag
This is necessary to be able to properly init a parser for unserialization.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-rw-r--r-- | usbredirparser/usbredirparser.c | 9 | ||||
-rw-r--r-- | usbredirparser/usbredirparser.h | 6 |
2 files changed, 9 insertions, 6 deletions
diff --git a/usbredirparser/usbredirparser.c b/usbredirparser/usbredirparser.c index d458aec..ce281ea 100644 --- a/usbredirparser/usbredirparser.c +++ b/usbredirparser/usbredirparser.c @@ -143,7 +143,7 @@ void usbredirparser_init(struct usbredirparser *parser_pub, (struct usbredirparser_priv *)parser_pub; struct usb_redir_hello_header hello; - parser->flags = flags; + parser->flags = (flags & ~usbredirparser_fl_no_hello); if (parser->callb.alloc_lock_func) { parser->lock = parser->callb.alloc_lock_func(); } @@ -157,9 +157,10 @@ void usbredirparser_init(struct usbredirparser *parser_pub, if (!(flags & usbredirparser_fl_usb_host)) usbredirparser_caps_set_cap(parser->our_caps, usb_redir_cap_device_disconnect_ack); - usbredirparser_queue(parser_pub, usb_redir_hello, 0, &hello, - (uint8_t *)parser->our_caps, - USB_REDIR_CAPS_SIZE * sizeof(uint32_t)); + if (!(flags & usbredirparser_fl_no_hello)) + usbredirparser_queue(parser_pub, usb_redir_hello, 0, &hello, + (uint8_t *)parser->our_caps, + USB_REDIR_CAPS_SIZE * sizeof(uint32_t)); } void usbredirparser_destroy(struct usbredirparser *parser_pub) diff --git a/usbredirparser/usbredirparser.h b/usbredirparser/usbredirparser.h index 82e1527..1d109b8 100644 --- a/usbredirparser/usbredirparser.h +++ b/usbredirparser/usbredirparser.h @@ -193,6 +193,7 @@ void usbredirparser_caps_set_cap(uint32_t *caps, int cap); enum { usbredirparser_fl_usb_host = 0x01, usbredirparser_fl_write_cb_owns_buffer = 0x02, + usbredirparser_fl_no_hello = 0x04, }; void usbredirparser_init(struct usbredirparser *parser, @@ -337,8 +338,9 @@ void usbredirparser_send_interrupt_packet(struct usbredirparser *parser, int usbredirparser_serialize(struct usbredirparser *parser, uint8_t **state_dest, int *state_len); -/* This function sets the current usbredirparser state from a serialized state, - this function assumes that the parser is in a clean initialized state. +/* This function sets the current usbredirparser state from a serialized state. + This function assumes that the parser has just been initialized with the + usbredirparser_fl_no_hello flag. Return value: 0 on success, -1 on error (out of memory, or invalid state data). */ |