|
|
@ -568,10 +568,19 @@ void can_send(SubSocket *subscriber) { |
|
|
|
int sent; |
|
|
|
int sent; |
|
|
|
pthread_mutex_lock(&usb_lock); |
|
|
|
pthread_mutex_lock(&usb_lock); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!fake_send) { |
|
|
|
if (!fake_send) { |
|
|
|
do { |
|
|
|
do { |
|
|
|
err = libusb_bulk_transfer(dev_handle, 3, (uint8_t*)send, msg_count*0x10, &sent, TIMEOUT); |
|
|
|
// Try sending can messages. If the receive buffer on the panda is full it will NAK
|
|
|
|
if (err != 0 || msg_count*0x10 != sent) { handle_usb_issue(err, __func__); } |
|
|
|
// and libusb will try again. After 5ms, it will time out. We will drop the messages.
|
|
|
|
|
|
|
|
err = libusb_bulk_transfer(dev_handle, 3, (uint8_t*)send, msg_count*0x10, &sent, 5); |
|
|
|
|
|
|
|
if (err == LIBUSB_ERROR_TIMEOUT) { |
|
|
|
|
|
|
|
LOGW("Transmit buffer full"); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} else if (err != 0 || msg_count*0x10 != sent) { |
|
|
|
|
|
|
|
LOGW("Error"); |
|
|
|
|
|
|
|
handle_usb_issue(err, __func__); |
|
|
|
|
|
|
|
} |
|
|
|
} while(err != 0); |
|
|
|
} while(err != 0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|