libhackrf support for HackRF One USB ID and board ID

This commit is contained in:
Michael Ossmann
2014-03-12 16:29:07 -06:00
parent dce15fa9f6
commit 716d140dfb
2 changed files with 11 additions and 2 deletions

View File

@ -112,7 +112,8 @@ static const max2837_ft_t max2837_ft[] = {
volatile bool do_exit = false;
static const uint16_t hackrf_usb_vid = 0x1d50;
static const uint16_t hackrf_usb_pid = 0x604b;
static const uint16_t hackrf_jawbreaker_usb_pid = 0x604b;
static const uint16_t hackrf_one_usb_pid = 0x6089;
static libusb_context* g_libusb_context = NULL;
@ -269,7 +270,11 @@ int ADDCALL hackrf_open(hackrf_device** device)
// TODO: Do proper scanning of available devices, searching for
// unit serial number (if specified?).
usb_device = libusb_open_device_with_vid_pid(g_libusb_context, hackrf_usb_vid, hackrf_usb_pid);
usb_device = libusb_open_device_with_vid_pid(g_libusb_context, hackrf_usb_vid, hackrf_one_usb_pid);
if( usb_device == NULL )
{
usb_device = libusb_open_device_with_vid_pid(g_libusb_context, hackrf_usb_vid, hackrf_jawbreaker_usb_pid);
}
if( usb_device == NULL )
{
return HACKRF_ERROR_NOT_FOUND;
@ -1278,6 +1283,9 @@ const char* ADDCALL hackrf_board_id_name(enum hackrf_board_id board_id)
case BOARD_ID_JAWBREAKER:
return "Jawbreaker";
case BOARD_ID_HACKRF_ONE:
return "HackRF One";
case BOARD_ID_INVALID:
return "Invalid Board ID";

View File

@ -65,6 +65,7 @@ enum hackrf_error {
enum hackrf_board_id {
BOARD_ID_JELLYBEAN = 0,
BOARD_ID_JAWBREAKER = 1,
BOARD_ID_HACKRF_ONE = 2,
BOARD_ID_INVALID = 0xFF,
};