Browse Source

Implement feature set query commands

The adapter can now be queried by the management tool to see
what configuration options and requests are available without
harcoding them for each release.
pull/5/head
Raphael Assenat 4 years ago
parent
commit
0e0c381fbd
4 changed files with 43 additions and 0 deletions
  1. +26
    -0
      hiddata.c
  2. +1
    -0
      hiddata.h
  3. +12
    -0
      main.c
  4. +4
    -0
      requests.h

+ 26
- 0
hiddata.c View File

@ -195,6 +195,32 @@ static void hiddata_processCommandBuffer(struct hiddata_ops *ops)
case RQ_GCN64_BLOCK_IO:
cmdbuf_len = processBlockIO();
break;
case RQ_RNT_GET_SUPPORTED_REQUESTS:
cmdbuf[1] = RQ_GCN64_JUMP_TO_BOOTLOADER;
cmdbuf[2] = RQ_GCN64_RAW_SI_COMMAND;
cmdbuf[3] = RQ_GCN64_GET_CONFIG_PARAM;
cmdbuf[4] = RQ_GCN64_SET_CONFIG_PARAM;
cmdbuf[5] = RQ_GCN64_SUSPEND_POLLING;
cmdbuf[6] = RQ_GCN64_GET_VERSION;
cmdbuf[7] = RQ_GCN64_GET_SIGNATURE;
cmdbuf[8] = RQ_GCN64_GET_CONTROLLER_TYPE;
cmdbuf[9] = RQ_GCN64_SET_VIBRATION;
cmdbuf[10] = RQ_GCN64_BLOCK_IO;
cmdbuf[11] = RQ_RNT_GET_SUPPORTED_CFG_PARAMS;
cmdbuf[12] = RQ_RNT_GET_SUPPORTED_MODES;
cmdbuf[13] = RQ_RNT_GET_SUPPORTED_REQUESTS;
cmdbuf_len = 14;
break;
case RQ_RNT_GET_SUPPORTED_CFG_PARAMS:
cmdbuf_len = 1 + config_getSupportedParams(cmdbuf + 1);
break;
case RQ_RNT_GET_SUPPORTED_MODES:
cmdbuf_len = 1;
if (ops && ops->getSupportedModes) {
cmdbuf_len += ops->getSupportedModes(cmdbuf + 1);
}
break;
}
#ifdef DEBUG


+ 1
- 0
hiddata.h View File

@ -7,6 +7,7 @@
struct hiddata_ops {
void (*suspendPolling)(uint8_t suspend);
void (*forceVibration)(uint8_t channel, uint8_t force);
uint8_t (*getSupportedModes)(uint8_t *dst);
};
uint16_t hiddata_get_report(void *ctx, struct usb_request *rq, const uint8_t **dat);


+ 12
- 0
main.c View File

@ -422,9 +422,21 @@ static void forceVibration(uint8_t channel, uint8_t force)
}
}
static uint8_t getSupportedModes(uint8_t *dst)
{
dst[0] = CFG_MODE_STANDARD;
dst[1] = CFG_MODE_N64_ONLY;
dst[2] = CFG_MODE_GC_ONLY;
dst[3] = CFG_MODE_2P_STANDARD;
dst[4] = CFG_MODE_2P_N64_ONLY;
dst[5] = CFG_MODE_2P_GC_ONLY;
return 6;
}
static struct hiddata_ops hiddata_ops = {
.suspendPolling = setSuspendPolling,
.forceVibration = forceVibration,
.getSupportedModes = getSupportedModes,
};
#define STATE_WAIT_POLLTIME 0


+ 4
- 0
requests.h View File

@ -11,6 +11,10 @@
#define RQ_GCN64_SET_VIBRATION 0x07
#define RQ_GCN64_RAW_SI_COMMAND 0x80
#define RQ_GCN64_BLOCK_IO 0x81
#define RQ_RNT_GET_SUPPORTED_REQUESTS 0xF0
#define RQ_RNT_GET_SUPPORTED_MODES 0xF1
#define RQ_RNT_GET_SUPPORTED_CFG_PARAMS 0xF2
#define RQ_RNT_RESET_FIRMWARE 0xFE
#define RQ_GCN64_JUMP_TO_BOOTLOADER 0xFF
/* Configuration parameters and constants */


Loading…
Cancel
Save