Bump hidapi from 1.1.1 to 1.2.0 (#8588)

automerge
This commit is contained in:
dependabot-preview[bot] 2020-03-09 11:53:47 -07:00 committed by GitHub
parent ea010be5cb
commit beead7e54d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 18 deletions

6
Cargo.lock generated
View File

@ -1412,7 +1412,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "hidapi"
version = "1.1.1"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cc 1.0.49 (registry+https://github.com/rust-lang/crates.io-index)",
@ -4337,7 +4337,7 @@ version = "1.1.0"
dependencies = [
"base32 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"dialoguer 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"hidapi 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"hidapi 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
"semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -6229,7 +6229,7 @@ dependencies = [
"checksum hex-literal 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "961de220ec9a91af2e1e5bd80d02109155695e516771762381ef8581317066e0"
"checksum hex-literal-impl 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "06095d08c7c05760f11a071b3e1d4c5b723761c01bd8d7201c30a9536668a612"
"checksum hex_fmt 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b07f60793ff0a4d9cef0f18e63b5357e06209987153a64648c972c1e5aff336f"
"checksum hidapi 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "289d0fb85e9ea18785708d4d735eca4f480b533b005e6f8aa2ffba0207800c75"
"checksum hidapi 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1cfd6cd631a5f39abaabad541f0b64bfcb7e55fa5c7de9a1e5d5578cb86dd687"
"checksum histogram 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "12cb882ccb290b8646e554b157ab0b71e64e8d5bef775cd66b6531e52d302669"
"checksum hmac 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5dcb5e64cda4c23119ab41ba960d1e170a774c8e4b9d9e6a9bc18aabf5e59695"
"checksum http 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)" = "d6ccf5ede3a895d8856620237b2f02972c1bbc78d2965ad7fe8838d4a0ed41f0"

View File

@ -11,7 +11,7 @@ homepage = "https://solana.com/"
[dependencies]
base32 = "0.4.0"
dialoguer = "0.5.0"
hidapi = { version = "1.1.1", default-features = false }
hidapi = { version = "1.2.0", default-features = false }
log = "0.4.8"
parking_lot = "0.10"
semver = "0.9"

View File

@ -249,24 +249,25 @@ impl LedgerWallet {
impl RemoteWallet for LedgerWallet {
fn read_device(
&self,
dev_info: &hidapi::HidDeviceInfo,
dev_info: &hidapi::DeviceInfo,
) -> Result<RemoteWalletInfo, RemoteWalletError> {
let manufacturer = dev_info
.manufacturer_string
.manufacturer_string()
.clone()
.unwrap_or_else(|| "Unknown".to_owned())
.unwrap_or("Unknown")
.to_lowercase()
.replace(" ", "-");
let model = dev_info
.product_string
.product_string()
.clone()
.unwrap_or_else(|| "Unknown".to_owned())
.unwrap_or("Unknown")
.to_lowercase()
.replace(" ", "-");
let serial = dev_info
.serial_number
.serial_number()
.clone()
.unwrap_or_else(|| "Unknown".to_owned());
.unwrap_or("Unknown")
.to_string();
let pubkey_result = self.get_pubkey(&DerivationPath::default(), false);
let (pubkey, error) = match pubkey_result {
Ok(pubkey) => (pubkey, None),

View File

@ -94,21 +94,20 @@ impl RemoteWalletManager {
pub fn update_devices(&self) -> Result<usize, RemoteWalletError> {
let mut usb = self.usb.lock();
usb.refresh_devices()?;
let devices = usb.devices();
let devices = usb.device_list();
let num_prev_devices = self.devices.read().len();
let detected_devices = devices
.iter()
.filter(|&device_info| {
is_valid_hid_device(device_info.usage_page, device_info.interface_number)
is_valid_hid_device(device_info.usage_page(), device_info.interface_number())
})
.fold(Vec::new(), |mut v, device_info| {
if is_valid_ledger(device_info.vendor_id, device_info.product_id) {
match usb.open_path(&device_info.path) {
if is_valid_ledger(device_info.vendor_id(), device_info.product_id()) {
match usb.open_path(&device_info.path()) {
Ok(device) => {
let ledger = LedgerWallet::new(device);
if let Ok(info) = ledger.read_device(&device_info) {
let path = device_info.path.to_str().unwrap().to_string();
let path = device_info.path().to_str().unwrap().to_string();
trace!("Found device: {:?}", info);
v.push(Device {
path,
@ -176,7 +175,7 @@ pub trait RemoteWallet {
/// Parse device info and get device base pubkey
fn read_device(
&self,
dev_info: &hidapi::HidDeviceInfo,
dev_info: &hidapi::DeviceInfo,
) -> Result<RemoteWalletInfo, RemoteWalletError>;
/// Get solana pubkey from a RemoteWallet