Skip to content

Commit

Permalink
ptp_generic_reset will only reset specific connection info
Browse files Browse the repository at this point in the history
  • Loading branch information
petabyt committed Oct 3, 2023
1 parent da6a3c2 commit dee218a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/libusb.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ struct LibUSBBackend {
};

int ptp_comm_init(struct PtpRuntime *r) {
ptp_generic_reset(r);

if (r->comm_backend != NULL) {
ptp_verbose_log("ptp_comm_init() called with comm backend already allocated\n");
return 0;
Expand Down
7 changes: 2 additions & 5 deletions src/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,19 @@
#include <ptp.h>

void ptp_generic_reset(struct PtpRuntime *r) {
memset(r, 0, sizeof(struct PtpRuntime));

r->active_connection = 0;
r->transaction = 0;
r->session = 0;
r->max_packet_size = 512;
r->data_phase_length = 0;
r->di = NULL;
r->connection_type = PTP_USB;
r->caller_unlocks_mutex = 0;
r->mutex = NULL;
r->wait_for_response = 1;
}

void ptp_generic_init(struct PtpRuntime *r) {
memset(r, 0, sizeof(struct PtpRuntime));
ptp_generic_reset(r);

r->data = malloc(CAMLIB_DEFAULT_SIZE);
r->data_length = CAMLIB_DEFAULT_SIZE;

Expand Down

0 comments on commit dee218a

Please sign in to comment.