Allow subclasses to refuse particular (vid, pid) pairs.

This commit is contained in:
Steve Checkoway
2006-02-24 10:47:33 +00:00
parent 19bb34974e
commit b760e127a8
2 changed files with 20 additions and 10 deletions
+15 -10
View File
@@ -47,20 +47,25 @@ bool HIDDevice::Open( io_object_t device )
object = CFDictionaryGetValue( properties, CFSTR(kIOHIDProductKey) );
CFTypeRef vidRef = CFDictionaryGetValue( properties, CFSTR(kIOHIDVendorIDKey) );
CFTypeRef pidRef = CFDictionaryGetValue( properties, CFSTR(kIOHIDProductIDKey) );
int vid, pid;
if( vidRef && !IntValue(vidRef, vid) )
vid = 0;
if( pidRef && !IntValue(pidRef, pid) )
pid = 0;
if( !SupportsVidPid(vid, pid) )
{
CFRelease( properties );
return false;
}
if( object && CFGetTypeID(object) == CFStringGetTypeID() )
m_sDescription = CFStringGetCStringPtr( CFStringRef(object), CFStringGetSystemEncoding() );
if( m_sDescription == "" )
{
CFTypeRef vidRef = CFDictionaryGetValue( properties, CFSTR(kIOHIDVendorIDKey) );
CFTypeRef pidRef = CFDictionaryGetValue( properties, CFSTR(kIOHIDProductIDKey) );
int vid, pid;
if( vidRef && !IntValue(vidRef, vid) )
vid = 0;
if( pidRef && !IntValue(pidRef, pid) )
pid = 0;
m_sDescription = ssprintf( "%04x:%04x", vid, pid );
}
object = CFDictionaryGetValue( properties, CFSTR(kIOHIDElementKey) );
if ( !object || CFGetTypeID(object) != CFArrayGetTypeID() )