Commit eb0b9dc8 authored by Sam Lantinga's avatar Sam Lantinga

Sort by HID usage, which makes more sense and is more cross-platform

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403236
parent 2b777b84
...@@ -331,20 +331,22 @@ HIDAddElement(CFTypeRef refElement, recDevice * pDevice) ...@@ -331,20 +331,22 @@ HIDAddElement(CFTypeRef refElement, recDevice * pDevice)
} }
if (element && headElement) { /* add to list */ if (element && headElement) { /* add to list */
pDevice->elements++; recElement *elementPrevious = NULL;
if (NULL == *headElement) recElement *elementCurrent = *headElement;
*headElement = element; while (elementCurrent && usage >= elementCurrent->usage) {
else { elementPrevious = elementCurrent;
recElement *elementPrevious, *elementCurrent; elementCurrent = elementCurrent->pNext;
elementCurrent = *headElement; }
while (elementCurrent) { if (elementPrevious) {
elementPrevious = elementCurrent;
elementCurrent = elementPrevious->pNext;
}
elementPrevious->pNext = element; elementPrevious->pNext = element;
} else {
*headElement = element;
} }
element->pNext = NULL; element->usagePage = usagePage;
element->usage = usage;
element->pNext = elementCurrent;
HIDGetElementInfo(refElement, element); HIDGetElementInfo(refElement, element);
pDevice->elements++;
} }
} }
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
struct recElement struct recElement
{ {
IOHIDElementCookie cookie; /* unique value which identifies element, will NOT change */ IOHIDElementCookie cookie; /* unique value which identifies element, will NOT change */
long usagePage, usage; /* HID usage */
long min; /* reported min value possible */ long min; /* reported min value possible */
long max; /* reported max value possible */ long max; /* reported max value possible */
#if 0 #if 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment