Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 716d140

Browse files
committed
libhackrf support for HackRF One USB ID and board ID
1 parent dce15fa commit 716d140

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

host/libhackrf/src/hackrf.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ static const max2837_ft_t max2837_ft[] = {
112112
volatile bool do_exit = false;
113113

114114
static const uint16_t hackrf_usb_vid = 0x1d50;
115-
static const uint16_t hackrf_usb_pid = 0x604b;
115+
static const uint16_t hackrf_jawbreaker_usb_pid = 0x604b;
116+
static const uint16_t hackrf_one_usb_pid = 0x6089;
116117

117118
static libusb_context* g_libusb_context = NULL;
118119

@@ -269,7 +270,11 @@ int ADDCALL hackrf_open(hackrf_device** device)
269270

270271
// TODO: Do proper scanning of available devices, searching for
271272
// unit serial number (if specified?).
272-
usb_device = libusb_open_device_with_vid_pid(g_libusb_context, hackrf_usb_vid, hackrf_usb_pid);
273+
usb_device = libusb_open_device_with_vid_pid(g_libusb_context, hackrf_usb_vid, hackrf_one_usb_pid);
274+
if( usb_device == NULL )
275+
{
276+
usb_device = libusb_open_device_with_vid_pid(g_libusb_context, hackrf_usb_vid, hackrf_jawbreaker_usb_pid);
277+
}
273278
if( usb_device == NULL )
274279
{
275280
return HACKRF_ERROR_NOT_FOUND;
@@ -1278,6 +1283,9 @@ const char* ADDCALL hackrf_board_id_name(enum hackrf_board_id board_id)
12781283
case BOARD_ID_JAWBREAKER:
12791284
return "Jawbreaker";
12801285

1286+
case BOARD_ID_HACKRF_ONE:
1287+
return "HackRF One";
1288+
12811289
case BOARD_ID_INVALID:
12821290
return "Invalid Board ID";
12831291

host/libhackrf/src/hackrf.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ enum hackrf_error {
6565
enum hackrf_board_id {
6666
BOARD_ID_JELLYBEAN = 0,
6767
BOARD_ID_JAWBREAKER = 1,
68+
BOARD_ID_HACKRF_ONE = 2,
6869
BOARD_ID_INVALID = 0xFF,
6970
};
7071

0 commit comments

Comments
 (0)