diff --git a/devices/viacuda.cpp b/devices/viacuda.cpp index cf9579b..ab64b38 100644 --- a/devices/viacuda.cpp +++ b/devices/viacuda.cpp @@ -317,6 +317,18 @@ void ViaCuda::process_adb_command(uint8_t cmd_byte, int data_count) void ViaCuda::pseudo_command(int cmd, int data_count) { switch (cmd) { + case CUDA_START_STOP_AUTO_POLL: + response_header(CUDA_PKT_PSEUDO, 0); + if (this->pram_obj->read_byte(this->in_buf[2])) { + if (this->via_regs[VIA_B] & 0x8) { + LOG_F(INFO, "Auto-polling started \n"); + this->via_regs[VIA_ACR] |= 0x10; + this->via_regs[VIA_SR] |= CUDA_PKT_PSEUDO; + this->via_regs[VIA_B] &= ~0x20; + } + } + + break; case CUDA_READ_PRAM: response_header(CUDA_PKT_PSEUDO, 0); this->pram_obj->read_byte(this->in_buf[2]); @@ -325,6 +337,15 @@ void ViaCuda::pseudo_command(int cmd, int data_count) response_header(CUDA_PKT_PSEUDO, 0); this->pram_obj->write_byte(this->in_buf[2], this->in_buf[3]); break; + case CUDA_SET_AUTO_RATE: + response_header(CUDA_PKT_PSEUDO, 0); + this->pram_obj->write_byte(this->in_buf[2], this->in_buf[3]); + LOG_F(INFO, "Auto Rate set to: %d \n", this->in_buf[3]); + break; + case CUDA_GET_AUTO_RATE: + response_header(CUDA_PKT_PSEUDO, 0); + this->pram_obj->read_byte(this->in_buf[2]); + break; case CUDA_READ_WRITE_I2C: response_header(CUDA_PKT_PSEUDO, 0); i2c_simple_transaction(this->in_buf[2], &this->in_buf[3], this->in_count - 3); diff --git a/devices/viacuda.h b/devices/viacuda.h index 9fba475..ae485db 100644 --- a/devices/viacuda.h +++ b/devices/viacuda.h @@ -87,11 +87,14 @@ enum { /** Cuda pseudo commands. */ enum { - CUDA_READ_PRAM = 0x07, /* read parameter RAM*/ - CUDA_WRITE_PRAM = 0x0C, /* write parameter RAM*/ - CUDA_READ_WRITE_I2C = 0x22, /* read/write I2C device */ - CUDA_COMB_FMT_I2C = 0x25, /* combined format I2C transaction */ - CUDA_OUT_PB0 = 0x26, /* output one bit to Cuda's PB0 line */ + CUDA_START_STOP_AUTO_POLL = 0x01, /* start/stop device auto-polling */ + CUDA_READ_PRAM = 0x07, /* read parameter RAM */ + CUDA_WRITE_PRAM = 0x0C, /* write parameter RAM */ + CUDA_SET_AUTO_RATE = 0x14, /* set auto-polling rate */ + CUDA_GET_AUTO_RATE = 0x16, /* get auto-polling rate */ + CUDA_READ_WRITE_I2C = 0x22, /* read/write I2C device */ + CUDA_COMB_FMT_I2C = 0x25, /* combined format I2C transaction */ + CUDA_OUT_PB0 = 0x26, /* output one bit to Cuda's PB0 line */ }; /** Cuda error codes. */