* Since the usages of the local state are now processed also for collections
there is no need to do the usage page and usage id handling anymore. * As this also removes the only use of the global state it is removed as well. * Try the usage maximum as a fallback as well and print something if none of the usage sources are valid and the collection ends up without a proper usage. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40954 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
|
|
||||||
HIDCollection::HIDCollection(HIDCollection *parent, uint8 type,
|
HIDCollection::HIDCollection(HIDCollection *parent, uint8 type,
|
||||||
global_item_state &globalState, local_item_state &localState)
|
local_item_state &localState)
|
||||||
: fParent(parent),
|
: fParent(parent),
|
||||||
fType(type),
|
fType(type),
|
||||||
fStringID(localState.string_index),
|
fStringID(localState.string_index),
|
||||||
@@ -30,17 +30,14 @@ HIDCollection::HIDCollection(HIDCollection *parent, uint8 type,
|
|||||||
fItems(NULL)
|
fItems(NULL)
|
||||||
{
|
{
|
||||||
usage_value usageValue;
|
usage_value usageValue;
|
||||||
usageValue.u.s.usage_page = globalState.usage_page;
|
if (localState.usage_stack != NULL && localState.usage_stack_used > 0)
|
||||||
if (localState.usage_stack != NULL && localState.usage_stack_used > 0) {
|
usageValue.u.extended = localState.usage_stack[0].u.extended;
|
||||||
if (localState.usage_stack[0].is_extended)
|
else if (localState.usage_minimum_set)
|
||||||
usageValue.u.extended = localState.usage_stack[0].u.extended;
|
usageValue.u.extended = localState.usage_minimum.u.extended;
|
||||||
else
|
else if (localState.usage_maximum_set)
|
||||||
usageValue.u.s.usage_id = localState.usage_stack[0].u.s.usage_id;
|
usageValue.u.extended = localState.usage_maximum.u.extended;
|
||||||
} else if (localState.usage_minimum_set) {
|
else {
|
||||||
if (localState.usage_minimum.is_extended)
|
TRACE_ALWAYS("non of the possible usages for the collection are set\n");
|
||||||
usageValue.u.extended = localState.usage_minimum.u.extended;
|
|
||||||
else
|
|
||||||
usageValue.u.s.usage_id = localState.usage_minimum.u.s.usage_id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fUsage = usageValue.u.extended;
|
fUsage = usageValue.u.extended;
|
||||||
|
|||||||
@@ -12,8 +12,7 @@ class HIDReportItem;
|
|||||||
class HIDCollection {
|
class HIDCollection {
|
||||||
public:
|
public:
|
||||||
HIDCollection(HIDCollection *parent,
|
HIDCollection(HIDCollection *parent,
|
||||||
uint8 type, global_item_state &globalState,
|
uint8 type, local_item_state &localState);
|
||||||
local_item_state &localState);
|
|
||||||
~HIDCollection();
|
~HIDCollection();
|
||||||
|
|
||||||
HIDCollection * Parent() { return fParent; };
|
HIDCollection * Parent() { return fParent; };
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ HIDParser::ParseReportDescriptor(const uint8 *reportDescriptor,
|
|||||||
if (item->tag == ITEM_TAG_MAIN_COLLECTION) {
|
if (item->tag == ITEM_TAG_MAIN_COLLECTION) {
|
||||||
HIDCollection *newCollection
|
HIDCollection *newCollection
|
||||||
= new(std::nothrow) HIDCollection(collection,
|
= new(std::nothrow) HIDCollection(collection,
|
||||||
(uint8)data, globalState, localState);
|
(uint8)data, localState);
|
||||||
if (newCollection == NULL) {
|
if (newCollection == NULL) {
|
||||||
TRACE_ALWAYS("no memory to allocate new collection\n");
|
TRACE_ALWAYS("no memory to allocate new collection\n");
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user