diff options
| author | Dario Nieuwenhuis <[email protected]> | 2022-07-11 22:44:42 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2022-07-11 22:44:42 +0200 |
| commit | 3ffdbd2ca3ed7cc3da95c391f1928342afb55e10 (patch) | |
| tree | 05173dd196d6034b1d217bf8162d7334577a4376 /src/lib.rs | |
| parent | 30b7800f9ae0a7f26e292dbe55cc67fbe2d1b131 (diff) | |
stuff
Diffstat (limited to 'src/lib.rs')
| -rw-r--r-- | src/lib.rs | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/src/lib.rs b/src/lib.rs index 040caed86..271917971 100644 --- a/src/lib.rs +++ b/src/lib.rs | |||
| @@ -243,7 +243,7 @@ impl<'a> Control<'a> { | |||
| 243 | info!("Configuring misc stuff..."); | 243 | info!("Configuring misc stuff..."); |
| 244 | 244 | ||
| 245 | self.set_iovar_u32("bus:txglom", 0).await; | 245 | self.set_iovar_u32("bus:txglom", 0).await; |
| 246 | self.set_iovar_u32("apsta", 1).await; | 246 | //self.set_iovar_u32("apsta", 1).await; |
| 247 | self.set_iovar("cur_etheraddr", &[02, 03, 04, 05, 06, 07]).await; | 247 | self.set_iovar("cur_etheraddr", &[02, 03, 04, 05, 06, 07]).await; |
| 248 | 248 | ||
| 249 | let country = countries::WORLD_WIDE_XX; | 249 | let country = countries::WORLD_WIDE_XX; |
| @@ -257,9 +257,13 @@ impl<'a> Control<'a> { | |||
| 257 | // set country takes some time, next ioctls fail if we don't wait. | 257 | // set country takes some time, next ioctls fail if we don't wait. |
| 258 | Timer::after(Duration::from_millis(100)).await; | 258 | Timer::after(Duration::from_millis(100)).await; |
| 259 | 259 | ||
| 260 | // self.set_iovar_u32("ampdu_ba_wsize", 8).await; | 260 | self.ioctl_set_u32(64, 0, 0).await; // WLC_SET_ANTDIV |
| 261 | // self.set_iovar_u32("ampdu_mpdu", 4).await; | 261 | |
| 262 | // self.set_iovar_u32("ampdu_rx_factor", 0).await; // this crashes | 262 | self.set_iovar_u32("bus:txglom", 0).await; |
| 263 | //self.set_iovar_u32("apsta", 1).await; | ||
| 264 | self.set_iovar_u32("ampdu_ba_wsize", 8).await; | ||
| 265 | self.set_iovar_u32("ampdu_mpdu", 4).await; | ||
| 266 | //self.set_iovar_u32("ampdu_rx_factor", 0).await; // this crashes | ||
| 263 | 267 | ||
| 264 | Timer::after(Duration::from_millis(100)).await; | 268 | Timer::after(Duration::from_millis(100)).await; |
| 265 | 269 | ||
| @@ -275,6 +279,12 @@ impl<'a> Control<'a> { | |||
| 275 | 279 | ||
| 276 | Timer::after(Duration::from_millis(100)).await; | 280 | Timer::after(Duration::from_millis(100)).await; |
| 277 | 281 | ||
| 282 | self.ioctl_set_u32(86, 0, 0).await; // no power save | ||
| 283 | self.ioctl_set_u32(110, 0, 1).await; // SET_GMODE = auto | ||
| 284 | self.ioctl_set_u32(142, 0, 0).await; // SET_BAND = any | ||
| 285 | |||
| 286 | Timer::after(Duration::from_millis(100)).await; | ||
| 287 | |||
| 278 | info!("INIT DONE"); | 288 | info!("INIT DONE"); |
| 279 | } | 289 | } |
| 280 | 290 | ||
| @@ -494,11 +504,11 @@ impl<'a, PWR: Pin, CS: Pin, CLK: Pin, DIO: Pin> Runner<'a, PWR, CS, CLK, DIO> { | |||
| 494 | let mut val = self.read8(FUNC_BACKPLANE, REG_BACKPLANE_SLEEP_CSR); | 504 | let mut val = self.read8(FUNC_BACKPLANE, REG_BACKPLANE_SLEEP_CSR); |
| 495 | val |= 0x01; // SBSDIO_SLPCSR_KEEP_SDIO_ON | 505 | val |= 0x01; // SBSDIO_SLPCSR_KEEP_SDIO_ON |
| 496 | self.write8(FUNC_BACKPLANE, REG_BACKPLANE_SLEEP_CSR, val); | 506 | self.write8(FUNC_BACKPLANE, REG_BACKPLANE_SLEEP_CSR, val); |
| 507 | */ | ||
| 497 | 508 | ||
| 498 | // clear pulls | 509 | // clear pulls |
| 499 | self.write8(FUNC_BACKPLANE, REG_BACKPLANE_PULL_UP, 0); | 510 | self.write8(FUNC_BACKPLANE, REG_BACKPLANE_PULL_UP, 0); |
| 500 | let _ = self.read8(FUNC_BACKPLANE, REG_BACKPLANE_PULL_UP); | 511 | let _ = self.read8(FUNC_BACKPLANE, REG_BACKPLANE_PULL_UP); |
| 501 | */ | ||
| 502 | 512 | ||
| 503 | info!("init done "); | 513 | info!("init done "); |
| 504 | } | 514 | } |
| @@ -595,14 +605,12 @@ impl<'a, PWR: Pin, CS: Pin, CLK: Pin, DIO: Pin> Runner<'a, PWR, CS, CLK, DIO> { | |||
| 595 | let packet = &payload[packet_start..]; | 605 | let packet = &payload[packet_start..]; |
| 596 | //info!("rx {:02x}", &packet[..(packet.len() as usize).min(36)]); | 606 | //info!("rx {:02x}", &packet[..(packet.len() as usize).min(36)]); |
| 597 | 607 | ||
| 598 | let evt = EventHeader::from_bytes(&packet[24..][..EventHeader::SIZE].try_into().unwrap()); | 608 | let mut evt = EventHeader::from_bytes(&packet[24..][..EventHeader::SIZE].try_into().unwrap()); |
| 599 | let evt_num = evt.event_type.to_be() as u8; | 609 | evt.byteswap(); |
| 600 | let evt_data_len = evt.datalen.to_be() as u8; | 610 | let evt_data = &packet[24 + EventHeader::SIZE..][..evt.datalen as usize]; |
| 601 | let evt_data = &packet[24 + EventHeader::SIZE..][..evt_data_len as usize]; | ||
| 602 | info!( | 611 | info!( |
| 603 | "=== EVENT {} ({}) {} {:02x}", | 612 | "=== EVENT {}: {} {:02x}", |
| 604 | events::Event::from(evt_num), | 613 | events::Event::from(evt.event_type as u8), |
| 605 | evt_num, | ||
| 606 | evt, | 614 | evt, |
| 607 | evt_data | 615 | evt_data |
| 608 | ); | 616 | ); |
