Merge pull request #58 from tgtakaoka/rf2500-fallback

Fallback to libusb backend when rf2500hidapi fails
This commit is contained in:
Daniel Beer 2018-06-27 11:58:41 +12:00 committed by GitHub
commit b30bf6ac30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 3 deletions

View File

@ -77,7 +77,7 @@ else
PORTS_LDFLAGS := -L/opt/local/lib -lhidapi -framework IOKit -framework CoreFoundation PORTS_LDFLAGS := -L/opt/local/lib -lhidapi -framework IOKit -framework CoreFoundation
endif endif
BSLHID_OBJ = transport/bslosx.o BSLHID_OBJ = transport/bslosx.o
RF25000_OBJ = transport/rf2500hidapi.o RF25000_OBJ += transport/rf2500hidapi.o
LDFLAGS = LDFLAGS =
else ifneq ($(filter $(UNAME_S),OpenBSD NetBSD DragonFly),) else ifneq ($(filter $(UNAME_S),OpenBSD NetBSD DragonFly),)
PORTS_CFLAGS := $(shell pkg-config --cflags libusb) PORTS_CFLAGS := $(shell pkg-config --cflags libusb)

View File

@ -228,7 +228,7 @@ static const struct transport_class rf2500_transport = {
.set_modem = usbtr_set_modem .set_modem = usbtr_set_modem
}; };
transport_t rf2500_open(const char *devpath, const char *requested_serial) transport_t rf2500_libusb_open(const char *devpath, const char *requested_serial)
{ {
struct rf2500_transport *tr = malloc(sizeof(*tr)); struct rf2500_transport *tr = malloc(sizeof(*tr));
struct usb_device *dev; struct usb_device *dev;

View File

@ -28,5 +28,6 @@
* A particular device may be specified in bus:dev form. * A particular device may be specified in bus:dev form.
*/ */
transport_t rf2500_open(const char *dev_path, const char *requested_serial); transport_t rf2500_open(const char *dev_path, const char *requested_serial);
transport_t rf2500_libusb_open(const char *dev_path, const char *requested_serial);
#endif #endif

View File

@ -196,7 +196,8 @@ transport_t rf2500_open(const char *devpath, const char *requested_serial)
printc_err("rf2500: failed to open RF2500 device\n"); printc_err("rf2500: failed to open RF2500 device\n");
free(tr); free(tr);
hid_exit(); hid_exit();
return NULL; printc_err("rf2500: fallback to libusb backend\n");
return rf2500_libusb_open(devpath, requested_serial);
} }
tr->handle = handle; tr->handle = handle;