Skip to content

Commit

Permalink
Add support for opening a DC_TRANSPORT_USBSTORAGE stream
Browse files Browse the repository at this point in the history
This is part of the whole "let's support the notion of dive computers
being exported as USB storage devices" push.

With an older libdivecomputer, we'll just fall back on failing the
operation, but we still want to support the generic notion of
DC_TRANSPORT_USBSTORAGE since we have our own internal Uemis downloader.
That one won't ever get to the open phase, since it's caught earlier.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
  • Loading branch information
torvalds authored and dirkhh committed Aug 28, 2018
1 parent 270e9ec commit 80fe8fb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions core/libdivecomputer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1342,6 +1342,12 @@ dc_status_t divecomputer_device_open(device_data_t *data)
return rc;
}

if (transports & DC_TRANSPORT_USBSTORAGE) {
rc = dc_usb_storage_open(&data->iostream, context, data->devname);
if (rc == DC_STATUS_SUCCESS)
return rc;
}

return DC_STATUS_UNSUPPORTED;
}

Expand Down
1 change: 1 addition & 0 deletions core/libdivecomputer.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// Even if we have an old libdivecomputer, Uemis uses this
#ifndef DC_TRANSPORT_USBSTORAGE
#define DC_TRANSPORT_USBSTORAGE (1 << 6)
#define dc_usb_storage_open(stream, context, devname) (DC_STATUS_UNSUPPORTED)
#endif

#include "dive.h"
Expand Down

0 comments on commit 80fe8fb

Please sign in to comment.