Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Bump hidapi from 1.1.1 to 1.2.0 #8588

Merged
merged 2 commits into from
Mar 9, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Update deprecated struct
  • Loading branch information
Tyera Eulberg committed Mar 9, 2020
commit a5f3731e528666941ab042d6ec359b66b3823699
15 changes: 8 additions & 7 deletions remote-wallet/src/ledger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
13 changes: 6 additions & 7 deletions remote-wallet/src/remote_wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down