mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-11 19:24:10 +01:00
Remove some comments
This commit is contained in:
parent
26ff40b5f3
commit
f8e5654ff4
@ -125,7 +125,6 @@ int pjrc_rawhid::open(int max, int vid, int pid, int usage_page, int usage)
|
|||||||
IOHIDManagerRegisterDeviceRemovalCallback(hid_manager, pjrc_rawhid::dettach_callback, this);
|
IOHIDManagerRegisterDeviceRemovalCallback(hid_manager, pjrc_rawhid::dettach_callback, this);
|
||||||
ret = IOHIDManagerOpen(hid_manager, kIOHIDOptionsTypeNone);
|
ret = IOHIDManagerOpen(hid_manager, kIOHIDOptionsTypeNone);
|
||||||
if (ret != kIOReturnSuccess) {
|
if (ret != kIOReturnSuccess) {
|
||||||
qDebug() << "Could not start IOHIDManager";
|
|
||||||
IOHIDManagerUnscheduleFromRunLoop(hid_manager,
|
IOHIDManagerUnscheduleFromRunLoop(hid_manager,
|
||||||
CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
|
CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
|
||||||
CFRelease(hid_manager);
|
CFRelease(hid_manager);
|
||||||
@ -152,8 +151,6 @@ int pjrc_rawhid::receive(int, void *buf, int len, int timeout)
|
|||||||
if (!device_open)
|
if (!device_open)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
qDebug() << "receiving";
|
|
||||||
|
|
||||||
// Pass information to the callback to stop this run loop and signal if a timeout occurred
|
// Pass information to the callback to stop this run loop and signal if a timeout occurred
|
||||||
struct timeout_info info;
|
struct timeout_info info;
|
||||||
info.loopRef = CFRunLoopGetCurrent();;
|
info.loopRef = CFRunLoopGetCurrent();;
|
||||||
@ -162,8 +159,6 @@ int pjrc_rawhid::receive(int, void *buf, int len, int timeout)
|
|||||||
memset(&context, 0, sizeof(context));
|
memset(&context, 0, sizeof(context));
|
||||||
context.info = &info;
|
context.info = &info;
|
||||||
|
|
||||||
qDebug() << "sending context info" << context.info;
|
|
||||||
|
|
||||||
// Set up the timer for the timeout
|
// Set up the timer for the timeout
|
||||||
CFRunLoopTimerRef timer;
|
CFRunLoopTimerRef timer;
|
||||||
timer = CFRunLoopTimerCreate(NULL, CFAbsoluteTimeGetCurrent() + (double)timeout / 1000.0, 0, 0, 0, timeout_callback, &context);
|
timer = CFRunLoopTimerCreate(NULL, CFAbsoluteTimeGetCurrent() + (double)timeout / 1000.0, 0, 0, 0, timeout_callback, &context);
|
||||||
@ -177,7 +172,6 @@ int pjrc_rawhid::receive(int, void *buf, int len, int timeout)
|
|||||||
buffer_count = 0;
|
buffer_count = 0;
|
||||||
break;
|
break;
|
||||||
} else if (info.timed_out) {
|
} else if (info.timed_out) {
|
||||||
qDebug() << "timed out";
|
|
||||||
len = 0;
|
len = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -187,8 +181,6 @@ int pjrc_rawhid::receive(int, void *buf, int len, int timeout)
|
|||||||
CFRunLoopTimerInvalidate(timer);
|
CFRunLoopTimerInvalidate(timer);
|
||||||
CFRelease(timer);
|
CFRelease(timer);
|
||||||
|
|
||||||
qDebug() << "received";
|
|
||||||
|
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -230,14 +222,12 @@ int pjrc_rawhid::send(int num, void *buf, int len, int timeout)
|
|||||||
uint8_t *report_buf = (uint8_t *) malloc(len);
|
uint8_t *report_buf = (uint8_t *) malloc(len);
|
||||||
memcpy(&report_buf[0], buf,len);
|
memcpy(&report_buf[0], buf,len);
|
||||||
|
|
||||||
qDebug() << "sending";
|
|
||||||
QEventLoop el;
|
QEventLoop el;
|
||||||
Sender sender(dev, report_buf, len);
|
Sender sender(dev, report_buf, len);
|
||||||
connect(&sender, SIGNAL(finished()), &el, SLOT(quit()));
|
connect(&sender, SIGNAL(finished()), &el, SLOT(quit()));
|
||||||
sender.start();
|
sender.start();
|
||||||
QTimer::singleShot(timeout, &el, SLOT(quit()));
|
QTimer::singleShot(timeout, &el, SLOT(quit()));
|
||||||
el.exec();
|
el.exec();
|
||||||
qDebug() << "sent";
|
|
||||||
|
|
||||||
return sender.result;
|
return sender.result;
|
||||||
}
|
}
|
||||||
@ -310,7 +300,6 @@ void pjrc_rawhid::input_callback(void *c, IOReturn ret, void *sender, IOHIDRepor
|
|||||||
//! Timeout used for the
|
//! Timeout used for the
|
||||||
void pjrc_rawhid::timeout_callback(CFRunLoopTimerRef, void *i)
|
void pjrc_rawhid::timeout_callback(CFRunLoopTimerRef, void *i)
|
||||||
{
|
{
|
||||||
qDebug() << "timeout_callback";
|
|
||||||
struct timeout_info *info = (struct timeout_info *) i;
|
struct timeout_info *info = (struct timeout_info *) i;
|
||||||
info->timed_out = true;
|
info->timed_out = true;
|
||||||
CFRunLoopStop(info->loopRef);
|
CFRunLoopStop(info->loopRef);
|
||||||
|
Loading…
Reference in New Issue
Block a user