this repo has no description
1#include "io_device_usb.h"
2
3// https://developer.apple.com/library/mac/#documentation/IOKit/Reference/USBSpec_header_reference/Reference/reference.html
4static const property_mapping usb_properties[] = {
5 property_mapping{ CFSTR("Serial Number"), nullptr, "serial", property_mapping::String },
6 property_mapping{ CFSTR("USB Product Name"), nullptr, "product", property_mapping::String },
7 property_mapping{ CFSTR("USB Vendor Name"), nullptr, "manufacturer", property_mapping::String },
8 property_mapping{ CFSTR("VendorID"), nullptr, "idVendor", property_mapping::Number16 },
9 property_mapping{ CFSTR("ProductID"), nullptr, "idProduct", property_mapping::Number16 },
10 property_mapping{ CFSTR("bInterfaceClass"), nullptr, "bInterfaceClass", property_mapping::Number16 },
11 property_mapping{ CFSTR("bInterfaceNumber"), nullptr, "bInterfaceNumber", property_mapping::Number16 },
12 property_mapping{ CFSTR("bDeviceClass"), nullptr, "bDeviceClass", property_mapping::Number16 },
13 property_mapping{ CFSTR("bDeviceSubClass"), nullptr, "bDeviceSubClass", property_mapping::Number16 },
14 property_mapping{ CFSTR("bDeviceProtocol"), nullptr, "bDeviceProtocol", property_mapping::Number16 },
15 property_mapping{ CFSTR("bMaxPacketSize0"), nullptr, "bMaxPacketSize0", property_mapping::Number10 },
16 property_mapping{ CFSTR("bNumConfigurations"), nullptr, "bNumConfigurations", property_mapping::Number10 },
17 property_mapping{ CFSTR("bNumEndpoints"), nullptr, "bNumEndpoints", property_mapping::Number10 },
18 property_mapping{ CFSTR("bConfigurationValue"), nullptr, "bConfigurationValue", property_mapping::Number10 },
19 property_mapping{ CFSTR("bcdDevice"), nullptr, "bcdDevice", property_mapping::Number16 },
20};
21
22
23CFTypeRef io_device_usb::property(CFStringRef name, CFAllocatorRef allocator)
24{
25 CFTypeRef v = retrieve(usb_properties, sizeof(usb_properties) / sizeof(usb_properties[0]), name, allocator);
26 if (v)
27 return v;
28 else
29 return io_device::property(name, allocator);
30}
31
32void io_device_usb::properties(CFMutableDictionaryRef dict, CFAllocatorRef allocator)
33{
34 io_device::properties(dict, allocator);
35 retrieveAll(dict, usb_properties, sizeof(usb_properties) / sizeof(usb_properties[0]), allocator);
36}