committed by
GitHub
parent
ea010be5cb
commit
beead7e54d
@ -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"
|
||||
|
@ -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),
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user