Class MacUsbDevice
java.lang.Object
oshi.hardware.common.AbstractUsbDevice
oshi.hardware.platform.mac.MacUsbDevice
- All Implemented Interfaces:
Comparable<UsbDevice>, UsbDevice
Mac Usb Device
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static voidaddDeviceAndChildrenToMaps(com.sun.jna.platform.mac.IOKit.IORegistryEntry device, long parentId, Map<Long, String> nameMap, Map<Long, String> vendorMap, Map<Long, String> vendorIdMap, Map<Long, String> productIdMap, Map<Long, String> serialMap, Map<Long, List<Long>> hubMap) Recursively populate maps with information from a USB Device and its childrenprivate static voidaddDevicesToList(List<UsbDevice> deviceList, List<UsbDevice> list) private static voidgetControllerIdByLocation(long id, com.sun.jna.platform.mac.CoreFoundation.CFTypeRef locationId, com.sun.jna.platform.mac.CoreFoundation.CFStringRef locationIDKey, com.sun.jna.platform.mac.CoreFoundation.CFStringRef ioPropertyMatchKey, Map<Long, String> vendorIdMap, Map<Long, String> productIdMap) Looks up vendor and product id information for a USB Host Controller by cross-referencing the locationprivate static MacUsbDevicegetDeviceAndChildren(Long registryEntryId, String vid, String pid, Map<Long, String> nameMap, Map<Long, String> vendorMap, Map<Long, String> vendorIdMap, Map<Long, String> productIdMap, Map<Long, String> serialMap, Map<Long, List<Long>> hubMap) Recursively creates MacUsbDevices by fetching information from maps to populate fieldsgetUsbDevices(boolean tree) Instantiates a list ofUsbDeviceobjects, representing devices connected via a usb port (including internal devices).Methods inherited from class AbstractUsbDevice
compareTo, getConnectedDevices, getName, getProductId, getSerialNumber, getUniqueDeviceId, getVendor, getVendorId, toString
-
Field Details
-
CF
private static final com.sun.jna.platform.mac.CoreFoundation CF -
IOUSB
- See Also:
-
IOSERVICE
- See Also:
-
-
Constructor Details
-
MacUsbDevice
-
-
Method Details
-
getUsbDevices
Instantiates a list ofUsbDeviceobjects, representing devices connected via a usb port (including internal devices).If the value of
treeis true, the top level devices returned from this method are the USB Controllers; connected hubs and devices in its device tree share that controller's bandwidth. If the value oftreeis false, USB devices (not controllers) are listed in a single flat list.- Parameters:
tree- If true, returns a list of controllers, which requires recursive iteration of connected devices. If false, returns a flat list of devices excluding controllers.- Returns:
- a list of
UsbDeviceobjects.
-
getUsbDevices
-
addDeviceAndChildrenToMaps
private static void addDeviceAndChildrenToMaps(com.sun.jna.platform.mac.IOKit.IORegistryEntry device, long parentId, Map<Long, String> nameMap, Map<Long, String> vendorMap, Map<Long, String> vendorIdMap, Map<Long, String> productIdMap, Map<Long, String> serialMap, Map<Long, List<Long>> hubMap) Recursively populate maps with information from a USB Device and its children- Parameters:
device- The device which, along with its children, should be addedparentId- The id of the device's parent.nameMap- the map of namesvendorMap- the map of vendorsvendorIdMap- the map of vendorIdsproductIdMap- the map of productIdsserialMap- the map of serial numbershubMap- the map of hubs
-
addDevicesToList
-
getControllerIdByLocation
private static void getControllerIdByLocation(long id, com.sun.jna.platform.mac.CoreFoundation.CFTypeRef locationId, com.sun.jna.platform.mac.CoreFoundation.CFStringRef locationIDKey, com.sun.jna.platform.mac.CoreFoundation.CFStringRef ioPropertyMatchKey, Map<Long, String> vendorIdMap, Map<Long, String> productIdMap) Looks up vendor and product id information for a USB Host Controller by cross-referencing the location- Parameters:
id- The global unique ID for the host controller used as a key for mapslocationId- The locationID of this controller returned from the registrylocationIDKey- A pointer to the locationID stringioPropertyMatchKey- A pointer to the IOPropertyMatch stringvendorIdMap- the map of vendorIdsproductIdMap- the map of productIds
-
getDeviceAndChildren
private static MacUsbDevice getDeviceAndChildren(Long registryEntryId, String vid, String pid, Map<Long, String> nameMap, Map<Long, String> vendorMap, Map<Long, String> vendorIdMap, Map<Long, String> productIdMap, Map<Long, String> serialMap, Map<Long, List<Long>> hubMap) Recursively creates MacUsbDevices by fetching information from maps to populate fields- Parameters:
registryEntryId- The device unique registry id.vid- The default (parent) vendor IDpid- The default (parent) product IDnameMap- the map of namesvendorMap- the map of vendorsvendorIdMap- the map of vendorIdsproductIdMap- the map of productIdsserialMap- the map of serial numbershubMap- the map of hubs- Returns:
- A MacUsbDevice corresponding to this device
-