* 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:
parent
baba9584dd
commit
6e499760b3
@ -18,7 +18,7 @@
|
||||
|
||||
|
||||
HIDCollection::HIDCollection(HIDCollection *parent, uint8 type,
|
||||
global_item_state &globalState, local_item_state &localState)
|
||||
local_item_state &localState)
|
||||
: fParent(parent),
|
||||
fType(type),
|
||||
fStringID(localState.string_index),
|
||||
@ -30,17 +30,14 @@ HIDCollection::HIDCollection(HIDCollection *parent, uint8 type,
|
||||
fItems(NULL)
|
||||
{
|
||||
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[0].is_extended)
|
||||
usageValue.u.extended = localState.usage_stack[0].u.extended;
|
||||
else
|
||||
usageValue.u.s.usage_id = localState.usage_stack[0].u.s.usage_id;
|
||||
} else if (localState.usage_minimum_set) {
|
||||
if (localState.usage_minimum.is_extended)
|
||||
usageValue.u.extended = localState.usage_minimum.u.extended;
|
||||
else
|
||||
usageValue.u.s.usage_id = localState.usage_minimum.u.s.usage_id;
|
||||
if (localState.usage_stack != NULL && localState.usage_stack_used > 0)
|
||||
usageValue.u.extended = localState.usage_stack[0].u.extended;
|
||||
else if (localState.usage_minimum_set)
|
||||
usageValue.u.extended = localState.usage_minimum.u.extended;
|
||||
else if (localState.usage_maximum_set)
|
||||
usageValue.u.extended = localState.usage_maximum.u.extended;
|
||||
else {
|
||||
TRACE_ALWAYS("non of the possible usages for the collection are set\n");
|
||||
}
|
||||
|
||||
fUsage = usageValue.u.extended;
|
||||
|
@ -12,8 +12,7 @@ class HIDReportItem;
|
||||
class HIDCollection {
|
||||
public:
|
||||
HIDCollection(HIDCollection *parent,
|
||||
uint8 type, global_item_state &globalState,
|
||||
local_item_state &localState);
|
||||
uint8 type, local_item_state &localState);
|
||||
~HIDCollection();
|
||||
|
||||
HIDCollection * Parent() { return fParent; };
|
||||
|
@ -132,7 +132,7 @@ HIDParser::ParseReportDescriptor(const uint8 *reportDescriptor,
|
||||
if (item->tag == ITEM_TAG_MAIN_COLLECTION) {
|
||||
HIDCollection *newCollection
|
||||
= new(std::nothrow) HIDCollection(collection,
|
||||
(uint8)data, globalState, localState);
|
||||
(uint8)data, localState);
|
||||
if (newCollection == NULL) {
|
||||
TRACE_ALWAYS("no memory to allocate new collection\n");
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user