From f2ab9338840a5220d9c2982bb4d7c74c18bd4e8b Mon Sep 17 00:00:00 2001 From: dingusdev Date: Thu, 23 Apr 2020 18:22:47 -0700 Subject: [PATCH] Slightly clean-up and expansion for future uses --- devices/adb.cpp | 26 +++++++++++++++++++++++--- devices/adb.h | 7 +++++-- devices/viacuda.cpp | 4 ++-- 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/devices/adb.cpp b/devices/adb.cpp index 9be789b..f4a3a23 100644 --- a/devices/adb.cpp +++ b/devices/adb.cpp @@ -28,12 +28,15 @@ along with this program. If not, see . #include #include #include "devices/adb.h" + #include #include #include #include #include +#include + using namespace std; ADB_Bus::ADB_Bus() { @@ -54,7 +57,7 @@ ADB_Bus::~ADB_Bus() { } -bool ADB_Bus::adb_verify_listen(int device, int reg) { +bool ADB_Bus::listen(int device, int reg) { if (device == keyboard_access_no) { if (adb_keybd_listen(reg)) { return true; @@ -71,11 +74,28 @@ bool ADB_Bus::adb_verify_listen(int device, int reg) { return false; } } - + else { + + return false; + } +} + +bool ADB_Bus::talk(int device, int reg, uint16_t value) { + //temp code return false; } -bool ADB_Bus::adb_verify_talk(int device, int reg) { +bool ADB_Bus::bus_reset() { + //temp code + return true; +} + +bool ADB_Bus::set_addr(int dev_addr, int new_addr) { + //temp code + return false; +} + +bool ADB_Bus::flush(int dev_addr) { //temp code return false; } diff --git a/devices/adb.h b/devices/adb.h index c41162a..2203e6c 100644 --- a/devices/adb.h +++ b/devices/adb.h @@ -39,8 +39,11 @@ public: ADB_Bus(); ~ADB_Bus(); - bool adb_verify_listen(int device, int reg); - bool adb_verify_talk(int device, int reg); + bool listen(int device, int reg); + bool talk(int device, int reg, uint16_t value); + bool bus_reset(); + bool set_addr(int dev_addr, int new_addr); + bool flush(int dev_addr); bool adb_keybd_listen(int reg); bool adb_mouse_listen(int reg); diff --git a/devices/viacuda.cpp b/devices/viacuda.cpp index a1524da..4fc4f13 100644 --- a/devices/viacuda.cpp +++ b/devices/viacuda.cpp @@ -307,7 +307,7 @@ void ViaCuda::process_adb_command(uint8_t cmd_byte, int data_count) else if ((cmd & 0xC) == 8) { LOG_F(9, "Cuda: ADB Listen command requested\n"); int adb_reg = cmd_byte & 0x3; - if (adb_obj->adb_verify_listen(adb_dev, adb_reg)){ + if (adb_obj->listen(adb_dev, adb_reg)){ response_header(CUDA_PKT_ADB, 0); for (int data_ptr = 0; data_ptr < adb_obj->get_output_len(); data_ptr++) { this->in_buf[(2 + data_ptr)] = adb_obj->get_output_byte(data_ptr); @@ -321,7 +321,7 @@ void ViaCuda::process_adb_command(uint8_t cmd_byte, int data_count) LOG_F(9, "Cuda: ADB Talk command requested\n"); response_header(CUDA_PKT_ADB, 0); int adb_reg = cmd_byte & 0x3; - if (adb_obj->adb_verify_talk(adb_dev, adb_reg)) { + if (adb_obj->talk(adb_dev, adb_reg, this->in_buf[2])) { response_header(CUDA_PKT_ADB, 0); } else {