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

Side by Side Diff: device/usb/usb_ids.h

Issue 11344039: Adding USB ID vendor and product lookups. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adding OWNERS Created 8 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 | Annotate | Revision Log
« no previous file with comments | « device/usb/OWNERS ('k') | device/usb/usb_ids.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef DEVICE_USB_USB_IDS_H_
6 #define DEVICE_USB_USB_IDS_H_
7
8 #include <stdint.h>
9
10 #include "base/basictypes.h"
11
12 namespace device {
13
14 struct UsbProduct {
15 const uint16_t id;
16 const char* name;
17 };
18
19 struct UsbVendor {
20 const uint16_t id;
21 const char* name;
22 const size_t product_size;
23 const UsbProduct* products;
24 };
25
26 // UsbIds provides a static mapping from a vendor ID to a name, as well as a
27 // mapping from a vendor/product ID pair to a product name.
28 class UsbIds {
29 public:
30 // Gets the name of the vendor who owns |vendor_id|. Returns NULL if the
31 // specified |vendor_id| does not exist.
32 static const char* GetVendorName(uint16_t vendor_id);
33
34 // Gets the name of a product belonging to a specific vendor. If either
35 // |vendor_id| refers to a vendor that does not exist, or |vendor_id| is valid
36 // but |product_id| refers to a product that does not exist, this method
37 // returns NULL.
38 static const char* GetProductName(uint16_t vendor_id, uint16_t product_id);
39
40 private:
41 UsbIds();
42 ~UsbIds();
43
44 // Finds the static UsbVendor associated with |vendor_id|. Returns NULL if no
45 // such vendor exists.
46 static const UsbVendor* FindVendor(uint16_t vendor_id);
47
48 // These fields are defined in a generated file. See device/device.gyp for
49 // more information on how they are generated.
50 static const size_t vendor_size_;
51 static const UsbVendor vendors_[];
52
53 DISALLOW_COPY_AND_ASSIGN(UsbIds);
54 };
55
56 } // namespace device
57
58 #endif // DEVICE_USB_USB_IDS_H_
OLDNEW
« no previous file with comments | « device/usb/OWNERS ('k') | device/usb/usb_ids.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698