- hexdump(transfer->buffer, transfer->actual_length, "> ");
- cb_data->cb(transfer->buffer, transfer->actual_length, cb_data->data);
+ hexdump(transfer->buffer, transfer->actual_length, "USB > ");
+
+ if (!cb_data->cb(transfer->buffer, transfer->actual_length, cb_data->data)) {
+ quit = EIO;
+
+ if (cb_data && cb_data->dev && cb_data->dev->transfer) {
+ libusb_free_transfer(cb_data->dev->transfer);
+ cb_data->dev->transfer = NULL;
+ free(cb_data);
+ }
+
+ return;
+ }