squish invalid gain values to acceptable levels

This commit is contained in:
Chris Kuethe
2015-05-29 00:05:12 -07:00
parent 2570f35260
commit faddb1b320

View File

@ -958,6 +958,7 @@ int ADDCALL hackrf_set_lna_gain(hackrf_device* device, uint32_t value)
return HACKRF_ERROR_INVALID_PARAM;
}
value &= ~(1<<3);
result = libusb_control_transfer(
device->usb_device,
LIBUSB_ENDPOINT_IN | LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE,
@ -987,6 +988,7 @@ int ADDCALL hackrf_set_vga_gain(hackrf_device* device, uint32_t value)
return HACKRF_ERROR_INVALID_PARAM;
}
value &= ~(1<<0);
result = libusb_control_transfer(
device->usb_device,
LIBUSB_ENDPOINT_IN | LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE,