Last active
November 2, 2018 13:43
-
-
Save yut23/6693f0f6ec67d6c3594b95f9d3fbd722 to your computer and use it in GitHub Desktop.
A patch for OpenOBEX 1.7.2 (https://gitlab.com/openobex/mainline) to support Livescribe pens
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/obex_client.c b/lib/obex_client.c | |
index f5b0f5a..68bc318 100644 | |
--- a/lib/obex_client.c | |
+++ b/lib/obex_client.c | |
@@ -190,6 +190,8 @@ static result_t obex_client_response_rx(obex_t *self) | |
if (rsp == OBEX_RSP_CONTINUE) { | |
enum obex_cmd cmd = self->object->cmd; | |
+ obex_object_reset_tx(self->object); | |
+ | |
DEBUG(3, "Continue...\n"); | |
obex_deliver_event(self, OBEX_EV_CONTINUE, cmd, rsp, false); | |
diff --git a/lib/obex_object.c b/lib/obex_object.c | |
index 7c230cd..79b5b98 100644 | |
--- a/lib/obex_object.c | |
+++ b/lib/obex_object.c | |
@@ -111,6 +111,24 @@ int obex_object_delete(obex_object_t *object) | |
return 0; | |
} | |
+int obex_object_reset_tx(obex_object_t *object) { | |
+ DEBUG(4, "\n"); | |
+ obex_return_val_if_fail(object != NULL, -1); | |
+ | |
+ /* Free the headerqueues */ | |
+ obex_hdr_it_destroy(object->tx_it); | |
+ object->tx_it = NULL; | |
+ free_headerq(object->tx_headerq, object->body); | |
+ object->tx_headerq = NULL; | |
+ /* Free tx non-header data */ | |
+ if (object->tx_nonhdr_data) { | |
+ buf_delete(object->tx_nonhdr_data); | |
+ object->tx_nonhdr_data = NULL; | |
+ } | |
+ | |
+ return 0; | |
+} | |
+ | |
/* | |
* Function obex_object_setcmd () | |
* | |
diff --git a/lib/obex_object.h b/lib/obex_object.h | |
index 1d6ed65..9664934 100644 | |
--- a/lib/obex_object.h | |
+++ b/lib/obex_object.h | |
@@ -63,6 +63,7 @@ struct obex_object { | |
struct obex_object *obex_object_new(void); | |
int obex_object_delete(struct obex_object *object); | |
+int obex_object_reset_tx(struct obex_object *object); | |
size_t obex_object_get_size(obex_object_t *object); | |
int obex_object_addheader(struct obex *self, struct obex_object *object, uint8_t hi, | |
obex_headerdata_t hv, uint32_t hv_size, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment