From bf150b91ef1c66922582adfb0dae4a26ac452bc5 Mon Sep 17 00:00:00 2001 From: Tim Patton <38817597+pattontim@users.noreply.github.com> Date: Sun, 30 Oct 2022 14:54:47 -0400 Subject: [PATCH 1/4] Hotfix BT controllers on SteamOS 3 --- scc/device_monitor.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scc/device_monitor.py b/scc/device_monitor.py index 24b6942c5..054b7de39 100644 --- a/scc/device_monitor.py +++ b/scc/device_monitor.py @@ -125,8 +125,13 @@ def _dev_for_hci(self, syspath): node_addr = DeviceMonitor._find_bt_address(node) except IOError: continue - if node_addr == addr: - return node + try: + # SteamOS 3 "Holo" return caps + if node_addr.lower() == addr.lower(): + return node + # None + except AttributeError: + pass return None From a380bdaa9ab032c33a342331eb7e5ad1d5f1a556 Mon Sep 17 00:00:00 2001 From: Christian Date: Sun, 17 Sep 2023 06:01:51 +0200 Subject: [PATCH 2/4] feat: support custom UDP port --- scc/cemuhook_server.c | 8 ++++++-- scc/cemuhook_server.py | 5 +++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/scc/cemuhook_server.c b/scc/cemuhook_server.c index db60e1472..44356fa70 100644 --- a/scc/cemuhook_server.c +++ b/scc/cemuhook_server.c @@ -346,8 +346,12 @@ bool sccd_cemuhook_socket_enable() { memset(&server_addr, 0, sizeof(struct sockaddr_in)); server_addr.sin_family = AF_INET; server_addr.sin_addr.s_addr = inet_addr("127.0.0.1"); - server_addr.sin_port = htons(26760); - + if (const char* custom_port = std::getenv("SERVER_PORT")) { + server_addr.sin_port = std::atoi(custom_port); + } else { + server_addr.sin_port = htons(26760); + } + #ifdef _WIN32 WSADATA wsaData; int err = WSAStartup(MAKEWORD(2, 2), &wsaData); diff --git a/scc/cemuhook_server.py b/scc/cemuhook_server.py index 548ec07d2..1f321e468 100644 --- a/scc/cemuhook_server.py +++ b/scc/cemuhook_server.py @@ -10,7 +10,7 @@ from scc.lib.enum import IntEnum from ctypes import c_uint32, c_int, c_bool, c_char_p, c_size_t, c_float from ctypes import create_string_buffer -import logging, socket +import logging, os, socket log = logging.getLogger("CemuHook") BUFFER_SIZE = 1024 @@ -47,7 +47,8 @@ def __init__(self, daemon): poller = daemon.get_poller() daemon.poller.register(self.socket.fileno(), poller.POLLIN, self.on_data_recieved) - self.socket.bind(('127.0.0.1', 26760)) + server_port = os.getenv('SERVER_PORT') or PORT; + self.socket.bind(('127.0.0.1', server_port)) log.info("Created CemuHookUDP Motion Provider") From fc2634b558d988151f513e0f307cb1c003fa2ce0 Mon Sep 17 00:00:00 2001 From: Christian Date: Thu, 28 Sep 2023 06:24:16 +0200 Subject: [PATCH 3/4] feat: support custom UDP port --- scc/cemuhook_server.c | 2 +- scc/cemuhook_server.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scc/cemuhook_server.c b/scc/cemuhook_server.c index 44356fa70..860993b95 100644 --- a/scc/cemuhook_server.c +++ b/scc/cemuhook_server.c @@ -346,7 +346,7 @@ bool sccd_cemuhook_socket_enable() { memset(&server_addr, 0, sizeof(struct sockaddr_in)); server_addr.sin_family = AF_INET; server_addr.sin_addr.s_addr = inet_addr("127.0.0.1"); - if (const char* custom_port = std::getenv("SERVER_PORT")) { + if (const char* custom_port = std::getenv("SCC_SERVER_PORT")) { server_addr.sin_port = std::atoi(custom_port); } else { server_addr.sin_port = htons(26760); diff --git a/scc/cemuhook_server.py b/scc/cemuhook_server.py index 1f321e468..a6adf7868 100644 --- a/scc/cemuhook_server.py +++ b/scc/cemuhook_server.py @@ -47,7 +47,7 @@ def __init__(self, daemon): poller = daemon.get_poller() daemon.poller.register(self.socket.fileno(), poller.POLLIN, self.on_data_recieved) - server_port = os.getenv('SERVER_PORT') or PORT; + server_port = os.getenv('SCC_SERVER_PORT') or PORT; self.socket.bind(('127.0.0.1', server_port)) log.info("Created CemuHookUDP Motion Provider") From 23c9be09422bb16cd23a6942c64e691822dfc0c1 Mon Sep 17 00:00:00 2001 From: Christian Date: Tue, 3 Oct 2023 10:00:59 +0200 Subject: [PATCH 4/4] fix: remove cpp namespace prefixes from c code --- scc/cemuhook_server.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scc/cemuhook_server.c b/scc/cemuhook_server.c index 860993b95..01d7c1245 100644 --- a/scc/cemuhook_server.c +++ b/scc/cemuhook_server.c @@ -346,8 +346,8 @@ bool sccd_cemuhook_socket_enable() { memset(&server_addr, 0, sizeof(struct sockaddr_in)); server_addr.sin_family = AF_INET; server_addr.sin_addr.s_addr = inet_addr("127.0.0.1"); - if (const char* custom_port = std::getenv("SCC_SERVER_PORT")) { - server_addr.sin_port = std::atoi(custom_port); + if (const char* custom_port = getenv("SCC_SERVER_PORT")) { + server_addr.sin_port = atoi(custom_port); } else { server_addr.sin_port = htons(26760); }