diff options
Diffstat (limited to 'src/driver_seq.c')
| -rw-r--r-- | src/driver_seq.c | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/src/driver_seq.c b/src/driver_seq.c new file mode 100644 index 0000000..307f49f --- /dev/null +++ b/src/driver_seq.c @@ -0,0 +1,67 @@ +/* + * driver_seq.c - the GV-MVP/RZ2 official driver's extra capture-start + * commands (recovered with Ghidra from p2usbRZ2.sys FUN_000217a2). + * + * IMPORTANT FINDING (verified on hardware): + * The driver's *complete* command list is NOT a drop-in replacement for + * the mpegcapt.c config: it omits several commands (0xbb/0xc7/0xd6/ + * 0x99/0xb7/0x89/0x95/0xa1) and sending only the driver list stalls the + * MPEG stream after one transfer. Conversely, the mpegcapt.c config + * plus the driver's 0xdc (MISC) group produces a full-rate, stable + * stream. + * + * So this function keeps the known-good mpegcapt.c config and appends + * the driver-only extras: the seven 0xdc (MISC) commands and the + * encoder status-flag clear. Video is stable; audio still does not + * appear, so the remaining audio enabler is elsewhere (see NOTES.md). + * + * Part of mpegcap. + */ +#include <stdio.h> + +#include "pvrusb2.h" + +int pvr2_encoder_config_driver(pvr2_dev *p, int sample_rate) +{ + uint32_t a[8]; + + /* Known-good base config (mpegcapt.c / Linux pvrusb2). */ + if (pvr2_encoder_config(p, sample_rate) < 0) { + if (p->verbose) + fprintf(stderr, "driver-seq: base config errors\n"); + return -1; + } + + /* + * Driver-only MISC (0xdc) group. + * + * ★ The values below were WRONG until 2026-10-14: they had been + * guessed from driver_capture_seq.txt, whose argument list is written + * in PUSH order (last argument first), so param0 and param1 came out + * swapped and two entries were invented. These are the values the + * driver actually sends, read out of the USB capture + * (/ROM/rz2-usb.pcap, EP 0x01, cmd 0xdc): six calls per session, in + * this order, with every other argument zero: + * MISC(5,0) MISC(3,1) MISC(8,0) + * MISC(4,1) MISC(0,3) MISC(15,0) + * (driver_capture_seq.txt's #5 "3,0" and #7 "[obj+0x1d8],EAX,0x0f" + * reverse to (0,3) and (0x0f,...) = 15, which do agree; #6 does not + * appear in the capture at all.) + * The same values are available as ENCMISC=1 in encoder.c. + */ + a[0] = 5; a[1] = 0; + (void)pvr2_enc_cmd(p, CX2341X_ENC_MISC, a, 2); + a[0] = 3; a[1] = 1; + (void)pvr2_enc_cmd(p, CX2341X_ENC_MISC, a, 2); + a[0] = 8; a[1] = 0; + (void)pvr2_enc_cmd(p, CX2341X_ENC_MISC, a, 2); + a[0] = 4; a[1] = 1; + (void)pvr2_enc_cmd(p, CX2341X_ENC_MISC, a, 2); + a[0] = 0; a[1] = 3; + (void)pvr2_enc_cmd(p, CX2341X_ENC_MISC, a, 2); + a[0] = 15; a[1] = 0; + (void)pvr2_enc_cmd(p, CX2341X_ENC_MISC, a, 2); + + return 0; +} + |
