remove yubideck_v3
use https://gitea.tendokyu.moe/beerpsi/chuniio-yubideck instead
This commit is contained in:
parent
bf59f9acb9
commit
a1790a9a48
@ -17,7 +17,6 @@ panic = "abort"
|
|||||||
chusan = []
|
chusan = []
|
||||||
tasoller_v1 = []
|
tasoller_v1 = []
|
||||||
tasoller_v2 = []
|
tasoller_v2 = []
|
||||||
yubideck_v3 = []
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
anyhow = "1.0.76"
|
anyhow = "1.0.76"
|
||||||
|
@ -23,7 +23,6 @@ coin=0x33
|
|||||||
Currently supported backends are:
|
Currently supported backends are:
|
||||||
- `tasoller_v1`
|
- `tasoller_v1`
|
||||||
- `tasoller_v2`
|
- `tasoller_v2`
|
||||||
- `yubideck_v3`
|
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
CONTROLLER="tasoller_v1" # replace with your preferred controller backend
|
CONTROLLER="tasoller_v1" # replace with your preferred controller backend
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
mkdir -p dist/chusan
|
mkdir -p dist/chusan
|
||||||
mkdir -p dist/chuni
|
mkdir -p dist/chuni
|
||||||
|
|
||||||
for backend in tasoller_v1 tasoller_v2 yubideck_v3
|
for backend in tasoller_v1 tasoller_v2
|
||||||
do
|
do
|
||||||
cargo build --target i686-pc-windows-msvc --release --features chusan,$backend
|
cargo build --target i686-pc-windows-msvc --release --features chusan,$backend
|
||||||
cargo build --target x86_64-pc-windows-msvc --release --features chusan,$backend
|
cargo build --target x86_64-pc-windows-msvc --release --features chusan,$backend
|
||||||
|
@ -19,8 +19,6 @@ cfg_if::cfg_if! {
|
|||||||
use crate::backends::tasoller_v1 as con_impl;
|
use crate::backends::tasoller_v1 as con_impl;
|
||||||
} else if #[cfg(feature = "tasoller_v2")] {
|
} else if #[cfg(feature = "tasoller_v2")] {
|
||||||
use crate::backends::tasoller_v2 as con_impl;
|
use crate::backends::tasoller_v2 as con_impl;
|
||||||
} else if #[cfg(feature = "yubideck_v3")] {
|
|
||||||
use crate::backends::yubideck_v3 as con_impl;
|
|
||||||
} else if #[cfg(feature = "my_controller")] {
|
} else if #[cfg(feature = "my_controller")] {
|
||||||
use crate::backends::my_controller as con_impl;
|
use crate::backends::my_controller as con_impl;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
pub mod dummy;
|
pub mod dummy;
|
||||||
pub mod tasoller_v1;
|
pub mod tasoller_v1;
|
||||||
pub mod tasoller_v2;
|
pub mod tasoller_v2;
|
||||||
pub mod yubideck_v3;
|
|
||||||
|
|
||||||
pub enum ReadType {
|
pub enum ReadType {
|
||||||
Bulk,
|
Bulk,
|
||||||
|
@ -1,139 +0,0 @@
|
|||||||
//! # YubiDeck v3
|
|
||||||
//! USB device: 1973:2001
|
|
||||||
//!
|
|
||||||
//! USB interface: 0
|
|
||||||
//!
|
|
||||||
//! Note that carding in using the YubiDeck card reader will not
|
|
||||||
//! work until a compatible `aimeio` implementation is provided.
|
|
||||||
//!
|
|
||||||
//! ## Protocol information
|
|
||||||
//!
|
|
||||||
//! ### IN Interrupt (0x81)
|
|
||||||
//! - Content length: 45 bytes
|
|
||||||
//! - Byte 0: IR data (bit 0 for lowest IR to bit 6 for highest)
|
|
||||||
//! - Byte 1:
|
|
||||||
//! - Bit 0: Test
|
|
||||||
//! - Bit 1: Service
|
|
||||||
//! - Bit 2: Coin
|
|
||||||
//! - Bytes 2..34: Touch sensor pressure (starts from top left,
|
|
||||||
//! top to bottom then left to right)
|
|
||||||
//! - Byte 34: Card type: (0: no card, 1: MIFARE Classic, 2: FeliCa)
|
|
||||||
//! - Byte 35..45: Card IDm/access code
|
|
||||||
//!
|
|
||||||
//! ### OUT Interrupt (0x02)
|
|
||||||
//! - Content length: 61 bytes
|
|
||||||
//! - Byte 0: Packet type
|
|
||||||
//! - Type 0:
|
|
||||||
//! - Bytes 1..61: Slider LED (RGB, right -> left, 20 final pixels)
|
|
||||||
//! - Type 1:
|
|
||||||
//! - Bytes 1..34: Slider LED (RGB, right -> left, 11 first pixels)
|
|
||||||
//! - Bytes 34..37: Left air LED (RGB)
|
|
||||||
//! - Bytes 37..40: Right air LED (RGB)
|
|
||||||
//! - Bytes 40..43: Card reader LED (RGB)
|
|
||||||
//! - Bytes 43..61: Padding
|
|
||||||
|
|
||||||
#[cfg(any(chuni, chusanapp))]
|
|
||||||
use anyhow::Result;
|
|
||||||
#[cfg(any(chuni, chusanapp))]
|
|
||||||
use rusb::{DeviceHandle, UsbContext};
|
|
||||||
|
|
||||||
use super::ReadType;
|
|
||||||
#[cfg(any(chuni, chusanapp))]
|
|
||||||
use crate::TIMEOUT;
|
|
||||||
|
|
||||||
pub const DEVICE_VID: u16 = 0x1973;
|
|
||||||
pub const DEVICE_PID: u16 = 0x2001;
|
|
||||||
pub const READ_TYPE: ReadType = ReadType::Interrupt;
|
|
||||||
pub const READ_ENDPOINT: u8 = 0x81;
|
|
||||||
pub const INPUT_MEMORY_SIZE: usize = 45;
|
|
||||||
pub const OUTPUT_MEMORY_SIZE: usize = 122;
|
|
||||||
|
|
||||||
#[cfg(any(chuni, amdaemon))]
|
|
||||||
#[inline(always)]
|
|
||||||
pub fn jvs_poll(input: &[u8]) -> (u8, u8) {
|
|
||||||
(input[1] & 3, input[0])
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(any(chuni, amdaemon))]
|
|
||||||
#[inline(always)]
|
|
||||||
pub fn is_coin_button_pressed(input: &[u8]) -> bool {
|
|
||||||
(input[1] & 4) != 0
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(any(chuni, chusanapp))]
|
|
||||||
#[inline(always)]
|
|
||||||
pub fn read_pressure_data(input: &[u8]) -> [u8; 32] {
|
|
||||||
let mut pressure = [0u8; 32];
|
|
||||||
|
|
||||||
for (i, p) in input.iter().skip(2).take(32).enumerate() {
|
|
||||||
pressure[if i % 2 == 0 { 30 - i } else { 32 - i }] = *p
|
|
||||||
}
|
|
||||||
|
|
||||||
pressure
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(any(chuni, chusanapp))]
|
|
||||||
#[inline(always)]
|
|
||||||
pub fn init_output_buffer(output: &mut [u8]) {
|
|
||||||
output[0] = 0;
|
|
||||||
output[61] = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(any(chuni, chusanapp))]
|
|
||||||
#[inline(always)]
|
|
||||||
pub fn set_slider_leds<T: UsbContext>(
|
|
||||||
device: &DeviceHandle<T>,
|
|
||||||
output: &mut [u8],
|
|
||||||
rgb: &[u8],
|
|
||||||
) -> Result<()> {
|
|
||||||
for (buf_chunk, state_chunk) in output[1..61].chunks_mut(3).zip(rgb.chunks(3).take(20)) {
|
|
||||||
buf_chunk[0] = state_chunk[0];
|
|
||||||
buf_chunk[1] = state_chunk[1];
|
|
||||||
buf_chunk[2] = state_chunk[2];
|
|
||||||
}
|
|
||||||
|
|
||||||
for (buf_chunk, state_chunk) in output[62..95]
|
|
||||||
.chunks_mut(3)
|
|
||||||
.zip(rgb.chunks(3).skip(20).take(11))
|
|
||||||
{
|
|
||||||
buf_chunk[0] = state_chunk[0];
|
|
||||||
buf_chunk[1] = state_chunk[1];
|
|
||||||
buf_chunk[2] = state_chunk[2];
|
|
||||||
}
|
|
||||||
|
|
||||||
device.write_interrupt(0x02, &output[0..61], TIMEOUT)?;
|
|
||||||
device.write_interrupt(0x02, &output[61..], TIMEOUT)?;
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(any(chuni, chusanapp))]
|
|
||||||
#[inline(always)]
|
|
||||||
pub fn set_led_colors<T: UsbContext>(
|
|
||||||
device: &DeviceHandle<T>,
|
|
||||||
output: &mut [u8],
|
|
||||||
board: u8,
|
|
||||||
rgb: &[u8],
|
|
||||||
) -> Result<()> {
|
|
||||||
if board != 0 && board != 1 {
|
|
||||||
return Ok(());
|
|
||||||
}
|
|
||||||
|
|
||||||
match board {
|
|
||||||
0 => {
|
|
||||||
output[95] = rgb[150];
|
|
||||||
output[96] = rgb[151];
|
|
||||||
output[97] = rgb[152];
|
|
||||||
}
|
|
||||||
1 => {
|
|
||||||
output[98] = rgb[180];
|
|
||||||
output[99] = rgb[181];
|
|
||||||
output[100] = rgb[182];
|
|
||||||
}
|
|
||||||
_ => unreachable!(),
|
|
||||||
}
|
|
||||||
|
|
||||||
device.write_interrupt(0x02, &output[61..], TIMEOUT)?;
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
@ -34,8 +34,6 @@ cfg_if::cfg_if! {
|
|||||||
use crate::backends::tasoller_v1 as con_impl;
|
use crate::backends::tasoller_v1 as con_impl;
|
||||||
} else if #[cfg(feature = "tasoller_v2")] {
|
} else if #[cfg(feature = "tasoller_v2")] {
|
||||||
use crate::backends::tasoller_v2 as con_impl;
|
use crate::backends::tasoller_v2 as con_impl;
|
||||||
} else if #[cfg(feature = "yubideck_v3")] {
|
|
||||||
use crate::backends::yubideck_v3 as con_impl;
|
|
||||||
} else {
|
} else {
|
||||||
use crate::backends::dummy as con_impl;
|
use crate::backends::dummy as con_impl;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user