Merge pull request #58 from tgtakaoka/rf2500-fallback
Fallback to libusb backend when rf2500hidapi fails
This commit is contained in:
commit
b30bf6ac30
2
Makefile
2
Makefile
|
@ -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)
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue