Refactor USB vendor/product to product string to UsbUtil.h.

Also implement reading of /var/lib/usbutils/usb.ids for systems that
have it (e.g. desktop Linux).
This commit is contained in:
Peter Johnson
2016-12-21 00:14:55 -08:00
parent 88afefe464
commit 10b13da3da
3 changed files with 182 additions and 40 deletions

21
src/UsbUtil.h Normal file
View File

@@ -0,0 +1,21 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#ifndef CS_USBUTIL_H_
#define CS_USBUTIL_H_
#include "llvm/SmallVector.h"
#include "llvm/StringRef.h"
namespace cs {
llvm::StringRef GetUsbNameFromId(int vendor, int product,
llvm::SmallVectorImpl<char>& buf);
} // namespace cs
#endif // CS_USBUTIL_H_