OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2012 The WebRTC Project Authors. All rights reserved. |
| 3 * |
| 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ |
| 10 |
| 11 #include "webrtc/media/devices/deviceinfo.h" |
| 12 |
| 13 namespace cricket { |
| 14 |
| 15 bool GetUsbId(const Device& device, std::string* usb_id) { |
| 16 // Both PID and VID are 4 characters. |
| 17 const int id_size = 4; |
| 18 if (device.id.size() < 2 * id_size) { |
| 19 return false; |
| 20 } |
| 21 |
| 22 // The last characters of device id is a concatenation of VID and then PID. |
| 23 const size_t vid_location = device.id.size() - 2 * id_size; |
| 24 std::string id_vendor = device.id.substr(vid_location, id_size); |
| 25 const size_t pid_location = device.id.size() - id_size; |
| 26 std::string id_product = device.id.substr(pid_location, id_size); |
| 27 |
| 28 usb_id->clear(); |
| 29 usb_id->append(id_vendor); |
| 30 usb_id->append(":"); |
| 31 usb_id->append(id_product); |
| 32 return true; |
| 33 } |
| 34 |
| 35 bool GetUsbVersion(const Device& device, std::string* usb_version) { |
| 36 return false; |
| 37 } |
| 38 |
| 39 } // namespace cricket |
OLD | NEW |