Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: fix osx compilation issues #67

Merged
merged 2 commits into from
Aug 18, 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
1 change: 1 addition & 0 deletions ledger/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ js-sys = "0.3.37"

[dev-dependencies]
serial_test = "0.3.2"
tokio = {version = "0.2.22", features = ["rt-threaded", "macros"]}

[features]
browser = []
Expand Down
20 changes: 10 additions & 10 deletions ledger/src/transports/hid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ use thiserror::Error;

use crate::{errors::LedgerError, common::{APDUAnswer, APDUCommand}};

use std::{ffi::CString, io::Cursor};

use byteorder::{BigEndian, ReadBytesExt};
use hidapi::HidDevice;
use std::cell::RefCell;
use std::sync::{Arc, Mutex, Weak};

cfg_if! {
if #[cfg(target_os = "linux")] {
Expand All @@ -14,21 +20,15 @@ cfg_if! {
} else {
// Mock the type in other target_os
mod nix {
quick_error! {
#[derive(Debug)]
pub enum Error {
}
#[derive(thiserror::Error, Debug)]
pub enum Error {
#[error("")]
Unimplemented,
}
}
}
}

use std::{ffi::CString, io::Cursor};

use byteorder::{BigEndian, ReadBytesExt};
use hidapi::HidDevice;
use std::cell::RefCell;
use std::sync::{Arc, Mutex, Weak};

const LEDGER_VID: u16 = 0x2c97;
const LEDGER_USAGE_PAGE: u16 = 0xFFA0;
Expand Down
12 changes: 6 additions & 6 deletions ledger/tests/integration.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use serial_test::serial;

use rmn_ledger::{
use coins_ledger::{
common::*,
transports::{self, hid, LedgerSync},
transports::{self, hid, LedgerAsync},
};

// // TODO: refactor or delete this
Expand Down Expand Up @@ -37,10 +37,10 @@ fn ledger_device_path() {
println!("{:?}", ledger_path);
}

#[test]
#[tokio::test]
#[serial]
fn exchange() {
let transport = transports::Ledger::init().expect("Could not get a device");
async fn exchange() {
let transport = transports::Ledger::init().await.expect("Could not get a device");
let buf: &[u8] = &[];
// Ethereum `get_app_version`
let command = APDUCommand {
Expand All @@ -50,6 +50,6 @@ fn exchange() {
data: buf.into(),
response_len: None,
};
let result = transport.exchange(&command).unwrap();
let result = transport.exchange(&command).await.unwrap();
println!("{}", result);
}