Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: device/serial/serial_device_enumerator_linux.cc

Issue 1542163002: Switch to standard integer types in device/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: win Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
OLDNEW
« no previous file with comments | « device/serial/serial_device_enumerator_linux.h ('k') | device/serial/serial_device_enumerator_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698