forked from Dniel97/segatools
Diva: Fix slider detection & sensor order
This commit is contained in:
parent
d32f6ab18b
commit
180dc3378a
@ -5,9 +5,11 @@
|
|||||||
enum {
|
enum {
|
||||||
SLIDER_CMD_AUTO_SCAN = 0x01,
|
SLIDER_CMD_AUTO_SCAN = 0x01,
|
||||||
SLIDER_CMD_SET_LED_CHUNI = 0x02,
|
SLIDER_CMD_SET_LED_CHUNI = 0x02,
|
||||||
|
SLIDER_CMD_SET_LED_DIVA = 0x02,
|
||||||
SLIDER_CMD_AUTO_SCAN_START = 0x03,
|
SLIDER_CMD_AUTO_SCAN_START = 0x03,
|
||||||
SLIDER_CMD_AUTO_SCAN_STOP = 0x04,
|
SLIDER_CMD_AUTO_SCAN_STOP = 0x04,
|
||||||
SLIDER_CMD_SET_LED_DIVA = 0x9,
|
SLIDER_CMD_DIVA_UNK_09 = 0x09,
|
||||||
|
SLIDER_CMD_DIVA_UNK_0A = 0x0A,
|
||||||
SLIDER_CMD_RESET = 0x10,
|
SLIDER_CMD_RESET = 0x10,
|
||||||
SLIDER_CMD_GET_BOARD_INFO = 0xF0,
|
SLIDER_CMD_GET_BOARD_INFO = 0xF0,
|
||||||
};
|
};
|
||||||
|
@ -24,6 +24,7 @@ static HRESULT slider_handle_irp(struct irp *irp);
|
|||||||
static HRESULT slider_handle_irp_locked(struct irp *irp);
|
static HRESULT slider_handle_irp_locked(struct irp *irp);
|
||||||
|
|
||||||
static HRESULT slider_req_dispatch(const union slider_req_any *req);
|
static HRESULT slider_req_dispatch(const union slider_req_any *req);
|
||||||
|
static HRESULT slider_req_nop(uint8_t cmd);
|
||||||
static HRESULT slider_req_reset(void);
|
static HRESULT slider_req_reset(void);
|
||||||
static HRESULT slider_req_get_board_info(void);
|
static HRESULT slider_req_get_board_info(void);
|
||||||
static HRESULT slider_req_auto_scan_start(void);
|
static HRESULT slider_req_auto_scan_start(void);
|
||||||
@ -146,6 +147,10 @@ static HRESULT slider_req_dispatch(const union slider_req_any *req)
|
|||||||
case SLIDER_CMD_SET_LED_DIVA:
|
case SLIDER_CMD_SET_LED_DIVA:
|
||||||
return slider_req_set_led(&req->set_led);
|
return slider_req_set_led(&req->set_led);
|
||||||
|
|
||||||
|
case SLIDER_CMD_DIVA_UNK_09:
|
||||||
|
case SLIDER_CMD_DIVA_UNK_0A:
|
||||||
|
return slider_req_nop(req->hdr.cmd);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
dprintf("Unhandled command %02x\n", req->hdr.cmd);
|
dprintf("Unhandled command %02x\n", req->hdr.cmd);
|
||||||
|
|
||||||
@ -153,6 +158,19 @@ static HRESULT slider_req_dispatch(const union slider_req_any *req)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static HRESULT slider_req_nop(uint8_t cmd)
|
||||||
|
{
|
||||||
|
struct slider_hdr resp;
|
||||||
|
|
||||||
|
dprintf("Diva slider: No-op cmd 0x%02x\n", cmd);
|
||||||
|
|
||||||
|
resp.sync = SLIDER_FRAME_SYNC;
|
||||||
|
resp.cmd = cmd;
|
||||||
|
resp.nbytes = 0;
|
||||||
|
|
||||||
|
return slider_frame_encode(&slider_uart.readable, &resp, sizeof(resp));
|
||||||
|
}
|
||||||
|
|
||||||
static HRESULT slider_req_reset(void)
|
static HRESULT slider_req_reset(void)
|
||||||
{
|
{
|
||||||
struct slider_hdr resp;
|
struct slider_hdr resp;
|
||||||
@ -181,7 +199,7 @@ static HRESULT slider_req_get_board_info(void)
|
|||||||
strcpy_s(
|
strcpy_s(
|
||||||
resp.version,
|
resp.version,
|
||||||
sizeof(resp.version),
|
sizeof(resp.version),
|
||||||
"15275 \xA0" "06712\xFF" "\x90");
|
"15275 \xA0" "06687\xFF" "\x90");
|
||||||
|
|
||||||
return slider_frame_encode(&slider_uart.readable, &resp, sizeof(resp));
|
return slider_frame_encode(&slider_uart.readable, &resp, sizeof(resp));
|
||||||
}
|
}
|
||||||
|
@ -122,7 +122,7 @@ static unsigned int __stdcall diva_io_slider_thread_proc(void *ctx)
|
|||||||
pressure_val = 0;
|
pressure_val = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&pressure[28 - 4 * i], pressure_val, 4);
|
memset(&pressure[4 * i], pressure_val, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
callback(pressure);
|
callback(pressure);
|
||||||
|
Loading…
Reference in New Issue
Block a user