this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

IOKit: support for BSD Major & Minor

+10
+8
src/IOKit/cfutil.h
··· 2 2 #define IOKIT_CFUTIL_H 3 3 #include <CoreFoundation/CFString.h> 4 4 #include <CoreFoundation/CFNumber.h> 5 + #include <cstdlib> 5 6 6 7 #define strCFEqual(cfs, cstr) (CFStringCompare(cfs, CFSTR(cstr), CFStringCompareFlags(0)) == 0) 7 8 ··· 15 16 inline CFNumberRef intToCF(int val, CFAllocatorRef all = kCFAllocatorDefault) 16 17 { 17 18 return CFNumberCreate(all, kCFNumberIntType, &val); 19 + } 20 + 21 + inline CFNumberRef intToCF(const char* val, CFAllocatorRef all = kCFAllocatorDefault) 22 + { 23 + if (!val) 24 + return nullptr; 25 + return intToCF(atoi(val), all); 18 26 } 19 27 20 28 #endif
+2
src/IOKit/io_device.cpp
··· 7 7 property_mapping{ CFSTR("IOVendor"), [](io_device* d, CFAllocatorRef a) -> CFTypeRef { if (const char* name = d->property("ID_VENDOR")) return strToCF(name, a); else return strToCF(d->property("ID_VENDOR_FROM_DATABASE"), a); } }, 8 8 property_mapping{ CFSTR("IOModel"), [](io_device* d, CFAllocatorRef a) -> CFTypeRef { if (const char* name = d->property("ID_MODEL")) return strToCF(name, a); else return strToCF(d->property("ID_MODEL_FROM_DATABASE"), a); } }, 9 9 property_mapping{ CFSTR("BSD Name"), [](io_device* d, CFAllocatorRef a) -> CFTypeRef { if (const char* name = d->sysname()) return strToCF(name, a); else return strToCF(d->property("INTERFACE"), a); } }, // name or property INTERFACE 10 + property_mapping{ CFSTR("BSD Major"), [](io_device* d, CFAllocatorRef a) -> CFTypeRef { return intToCF(d->property("MAJOR"), a); } }, 11 + property_mapping{ CFSTR("BSD Minor"), [](io_device* d, CFAllocatorRef a) -> CFTypeRef { return intToCF(d->property("MINOR"), a); } }, 10 12 }; 11 13 12 14 io_device::io_device(struct udev_device* dev)