| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "device/serial/serial_device_enumerator_mac.h" | 5 #include "device/serial/serial_device_enumerator_mac.h" |
| 6 | 6 |
| 7 #include <IOKit/serial/IOSerialKeys.h> | 7 #include <IOKit/serial/IOSerialKeys.h> |
| 8 #include <IOKit/usb/IOUSBLib.h> | 8 #include <IOKit/usb/IOUSBLib.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 uint16_t productId; | 130 uint16_t productId; |
| 131 if (GetUInt16Property(scoped_device.get(), CFSTR(kUSBProductID), | 131 if (GetUInt16Property(scoped_device.get(), CFSTR(kUSBProductID), |
| 132 &productId)) { | 132 &productId)) { |
| 133 callout_info->has_product_id = true; | 133 callout_info->has_product_id = true; |
| 134 callout_info->product_id = productId; | 134 callout_info->product_id = productId; |
| 135 } | 135 } |
| 136 | 136 |
| 137 mojo::String displayName; | 137 mojo::String displayName; |
| 138 if (GetStringProperty(scoped_device.get(), CFSTR(kUSBProductString), | 138 if (GetStringProperty(scoped_device.get(), CFSTR(kUSBProductString), |
| 139 &displayName)) { | 139 &displayName)) { |
| 140 callout_info->display_name = displayName; | 140 callout_info->display_name = displayName.PassStorage(); |
| 141 } | 141 } |
| 142 | 142 |
| 143 // Each serial device has two "paths" in /dev/ associated with it: a | 143 // Each serial device has two "paths" in /dev/ associated with it: a |
| 144 // "dialin" path starting with "tty" and a "callout" path starting with | 144 // "dialin" path starting with "tty" and a "callout" path starting with |
| 145 // "cu". Each of these is considered a different device from Chrome's | 145 // "cu". Each of these is considered a different device from Chrome's |
| 146 // standpoint, but both should share the device's USB properties. | 146 // standpoint, but both should share the device's USB properties. |
| 147 mojo::String dialinDevice; | 147 mojo::String dialinDevice; |
| 148 if (GetStringProperty(scoped_device.get(), CFSTR(kIODialinDeviceKey), | 148 if (GetStringProperty(scoped_device.get(), CFSTR(kIODialinDeviceKey), |
| 149 &dialinDevice)) { | 149 &dialinDevice)) { |
| 150 serial::DeviceInfoPtr dialin_info = callout_info.Clone(); | 150 serial::DeviceInfoPtr dialin_info = callout_info.Clone(); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 } | 235 } |
| 236 | 236 |
| 237 mojo::Array<mojo::String> paths; | 237 mojo::Array<mojo::String> paths; |
| 238 mojo::Array<serial::DeviceInfoPtr> devices; | 238 mojo::Array<serial::DeviceInfoPtr> devices; |
| 239 deviceMap.DecomposeMapTo(&paths, &devices); | 239 deviceMap.DecomposeMapTo(&paths, &devices); |
| 240 | 240 |
| 241 return devices; | 241 return devices; |
| 242 } | 242 } |
| 243 | 243 |
| 244 } // namespace device | 244 } // namespace device |
| OLD | NEW |