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_linux.h" | 5 #include "device/serial/serial_device_enumerator_linux.h" |
6 | 6 |
| 7 #include <stdint.h> |
| 8 |
7 #include "base/logging.h" | 9 #include "base/logging.h" |
8 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
9 | 11 |
10 namespace device { | 12 namespace device { |
11 | 13 |
12 namespace { | 14 namespace { |
13 | 15 |
14 const char kSerialSubsystem[] = "tty"; | 16 const char kSerialSubsystem[] = "tty"; |
15 | 17 |
16 const char kHostPathKey[] = "DEVNAME"; | 18 const char kHostPathKey[] = "DEVNAME"; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 serial::DeviceInfoPtr info(serial::DeviceInfo::New()); | 66 serial::DeviceInfoPtr info(serial::DeviceInfo::New()); |
65 info->path = path; | 67 info->path = path; |
66 | 68 |
67 const char* vendor_id = | 69 const char* vendor_id = |
68 udev_device_get_property_value(device.get(), kVendorIDKey); | 70 udev_device_get_property_value(device.get(), kVendorIDKey); |
69 const char* product_id = | 71 const char* product_id = |
70 udev_device_get_property_value(device.get(), kProductIDKey); | 72 udev_device_get_property_value(device.get(), kProductIDKey); |
71 const char* product_name = | 73 const char* product_name = |
72 udev_device_get_property_value(device.get(), kProductNameKey); | 74 udev_device_get_property_value(device.get(), kProductNameKey); |
73 | 75 |
74 uint32 int_value; | 76 uint32_t int_value; |
75 if (vendor_id && base::HexStringToUInt(vendor_id, &int_value)) { | 77 if (vendor_id && base::HexStringToUInt(vendor_id, &int_value)) { |
76 info->vendor_id = int_value; | 78 info->vendor_id = int_value; |
77 info->has_vendor_id = true; | 79 info->has_vendor_id = true; |
78 } | 80 } |
79 if (product_id && base::HexStringToUInt(product_id, &int_value)) { | 81 if (product_id && base::HexStringToUInt(product_id, &int_value)) { |
80 info->product_id = int_value; | 82 info->product_id = int_value; |
81 info->has_product_id = true; | 83 info->has_product_id = true; |
82 } | 84 } |
83 if (product_name) | 85 if (product_name) |
84 info->display_name = product_name; | 86 info->display_name = product_name; |
85 devices.push_back(info.Pass()); | 87 devices.push_back(info.Pass()); |
86 } | 88 } |
87 } | 89 } |
88 return devices.Pass(); | 90 return devices.Pass(); |
89 } | 91 } |
90 | 92 |
91 } // namespace device | 93 } // namespace device |
OLD | NEW |