Fix up frequency list size
This commit is contained in:
@ -45,7 +45,7 @@ usb_request_status_t usb_vendor_request_init_sweep(
|
|||||||
usb_endpoint_t* const endpoint, const usb_transfer_stage_t stage)
|
usb_endpoint_t* const endpoint, const usb_transfer_stage_t stage)
|
||||||
{
|
{
|
||||||
if (stage == USB_TRANSFER_STAGE_SETUP) {
|
if (stage == USB_TRANSFER_STAGE_SETUP) {
|
||||||
frequency_count = endpoint->setup.length;
|
frequency_count = endpoint->setup.length / sizeof(uint16_t);
|
||||||
usb_transfer_schedule_block(endpoint->out, &frequencies,
|
usb_transfer_schedule_block(endpoint->out, &frequencies,
|
||||||
endpoint->setup.length, NULL, NULL);
|
endpoint->setup.length, NULL, NULL);
|
||||||
} else if (stage == USB_TRANSFER_STAGE_DATA) {
|
} else if (stage == USB_TRANSFER_STAGE_DATA) {
|
||||||
|
@ -1702,6 +1702,7 @@ int ADDCALL hackrf_init_sweep(hackrf_device* device,
|
|||||||
int length)
|
int length)
|
||||||
{
|
{
|
||||||
int result, i;
|
int result, i;
|
||||||
|
int size = length * sizeof(frequency_list[0]);
|
||||||
|
|
||||||
for(i=0; i<length; i++)
|
for(i=0; i<length; i++)
|
||||||
frequency_list[i] = TO_LE(frequency_list[i]);
|
frequency_list[i] = TO_LE(frequency_list[i]);
|
||||||
@ -1713,11 +1714,11 @@ int ADDCALL hackrf_init_sweep(hackrf_device* device,
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
(unsigned char*)frequency_list,
|
(unsigned char*)frequency_list,
|
||||||
length,
|
size,
|
||||||
0
|
0
|
||||||
);
|
);
|
||||||
|
|
||||||
if (result < length) {
|
if (result < size) {
|
||||||
return HACKRF_ERROR_LIBUSB;
|
return HACKRF_ERROR_LIBUSB;
|
||||||
} else {
|
} else {
|
||||||
return HACKRF_SUCCESS;
|
return HACKRF_SUCCESS;
|
||||||
|
Reference in New Issue
Block a user