Skip to content

Commit

Permalink
Merge pull request #231 from LedgerHQ/y333/fix_bluetooth_spi
Browse files Browse the repository at this point in the history
Increase SPI buffer size (Bluetooth issue)
  • Loading branch information
yogh333 authored Jan 14, 2025
2 parents 63c08b1 + 3641db6 commit 73c7117
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ledger_device_sdk/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ledger_device_sdk"
version = "1.19.1"
version = "1.19.2"
authors = ["yhql", "yogh333", "agrojean-ledger", "kingofpayne"]
edition = "2021"
license.workspace = true
Expand Down
12 changes: 6 additions & 6 deletions ledger_device_sdk/src/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ impl Comm {
if !sys_seph::is_status_sent() {
sys_seph::send_general_status()
}
let mut spi_buffer = [0u8; 128];
let mut spi_buffer = [0u8; 256];
while sys_seph::is_status_sent() {
sys_seph::seph_recv(&mut spi_buffer, 0);
seph::handle_event(&mut self.apdu_buffer, &spi_buffer);
Expand Down Expand Up @@ -260,7 +260,7 @@ impl Comm {
T: TryFrom<ApduHeader>,
Reply: From<<T as TryFrom<ApduHeader>>::Error>,
{
let mut spi_buffer = [0u8; 128];
let mut spi_buffer = [0u8; 256];

unsafe {
G_io_app.apdu_state = APDU_IDLE;
Expand Down Expand Up @@ -289,7 +289,7 @@ impl Comm {
T: TryFrom<ApduHeader>,
Reply: From<<T as TryFrom<ApduHeader>>::Error>,
{
let mut spi_buffer = [0u8; 128];
let mut spi_buffer = [0u8; 256];

// Signal end of command stream from SE to MCU
// And prepare reception
Expand Down Expand Up @@ -353,7 +353,7 @@ impl Comm {
None
}

pub fn process_event<T>(&mut self, spi_buffer: &mut [u8; 128]) -> Option<Event<T>>
pub fn process_event<T>(&mut self, spi_buffer: &mut [u8; 256]) -> Option<Event<T>>
where
T: TryFrom<ApduHeader>,
Reply: From<<T as TryFrom<ApduHeader>>::Error>,
Expand Down Expand Up @@ -422,7 +422,7 @@ impl Comm {
None
}

pub fn decode_event<T>(&mut self, spi_buffer: &mut [u8; 128]) -> Option<Event<T>>
pub fn decode_event<T>(&mut self, spi_buffer: &mut [u8; 256]) -> Option<Event<T>>
where
T: TryFrom<ApduHeader>,
Reply: From<<T as TryFrom<ApduHeader>>::Error>,
Expand All @@ -439,7 +439,7 @@ impl Comm {
None
}

fn detect_apdu<T>(&mut self, spi_buffer: &mut [u8; 128]) -> bool
fn detect_apdu<T>(&mut self, spi_buffer: &mut [u8; 256]) -> bool
where
T: TryFrom<ApduHeader>,
Reply: From<<T as TryFrom<ApduHeader>>::Error>,
Expand Down
4 changes: 2 additions & 2 deletions ledger_device_sdk/src/seph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use ledger_secure_sdk_sys::*;

#[cfg(target_os = "nanox")]
#[cfg(any(target_os = "nanox", target_os = "stax", target_os = "flex"))]
use crate::ble;

#[repr(u8)]
Expand Down Expand Up @@ -198,7 +198,7 @@ pub fn handle_event(apdu_buffer: &mut [u8], spi_buffer: &[u8]) {
handle_usb_ep_xfer_event(apdu_buffer, spi_buffer);
}
}
#[cfg(target_os = "nanox")]
#[cfg(any(target_os = "nanox", target_os = "stax", target_os = "flex"))]
Events::BleReceive => ble::receive(apdu_buffer, spi_buffer),
Events::CAPDUEvent => handle_capdu_event(apdu_buffer, spi_buffer),
Events::TickerEvent => { /* unsafe{ G_io_app.ms += 100; } */ }
Expand Down
4 changes: 2 additions & 2 deletions ledger_device_sdk/src/uxapp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl UxEvent {
if unsafe { os_sched_is_running(TASK_SUBTASKS_START as u32) }
!= BOLOS_TRUE.try_into().unwrap()
{
let mut spi_buffer = [0u8; 128];
let mut spi_buffer = [0u8; 256];
sys_seph::send_general_status();
sys_seph::seph_recv(&mut spi_buffer, 0);
UxEvent::Event.request();
Expand All @@ -78,7 +78,7 @@ impl UxEvent {
if unsafe { os_sched_is_running(TASK_SUBTASKS_START as u32) }
!= BOLOS_TRUE.try_into().unwrap()
{
let mut spi_buffer = [0u8; 128];
let mut spi_buffer = [0u8; 256];
seph::send_general_status();
seph::seph_recv(&mut spi_buffer, 0);
event = comm.decode_event(&mut spi_buffer);
Expand Down

0 comments on commit 73c7117

Please sign in to comment.