Skip to content

Commit

Permalink
libhackrf support for HackRF One USB ID and board ID
Browse files Browse the repository at this point in the history
  • Loading branch information
mossmann committed Mar 12, 2014
1 parent dce15fa commit 716d140
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
12 changes: 10 additions & 2 deletions host/libhackrf/src/hackrf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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";

Expand Down
1 change: 1 addition & 0 deletions host/libhackrf/src/hackrf.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand Down

0 comments on commit 716d140

Please sign in to comment.