Skip to content

Instantly share code, notes, and snippets.

@ITotalJustice
Created July 29, 2025 12:33
Show Gist options
  • Save ITotalJustice/d553c6a6a3b30ef922baea64e7857374 to your computer and use it in GitHub Desktop.
Save ITotalJustice/d553c6a6a3b30ef922baea64e7857374 to your computer and use it in GitHub Desktop.
dkp patches
From 92e89e25fb077a0389e86740879bdd7bbb99a3b8 Mon Sep 17 00:00:00 2001
From: ITotalJustice <[email protected]>
Date: Mon, 25 Nov 2024 21:03:43 +0000
Subject: [PATCH] fix wps
---
source/wfc.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/source/wfc.c b/source/wfc.c
index 5a0bb75..26da698 100644
--- a/source/wfc.c
+++ b/source/wfc.c
@@ -402,7 +402,8 @@ static void _wfcOnEvent(void* user, WlMgrEvent event, uptr arg0, uptr arg1)
break;
}
- case WfcConnType_WpaNormal: {
+ case WfcConnType_WpaNormal:
+ case WfcConnType_WpaWps: {
bss->auth_type = (WlanBssAuthType)slot->wpa_mode;
memcpy(auth.wpa_psk, slot->wpa_pmk, WLAN_WPA_PSK_LEN);
break;
@@ -558,7 +559,7 @@ bool wfcLoadSlot(const WfcConnSlot* slot)
bool wfcLoadSlotEx(const WfcConnSlotEx* slot)
{
- if (slot->base.conn_type != WfcConnType_WepNormal && slot->base.conn_type != WfcConnType_WpaNormal) {
+ if (slot->base.conn_type != WfcConnType_WepNormal && slot->base.conn_type != WfcConnType_WpaNormal && slot->base.conn_type != WfcConnType_WpaWps) {
return false;
}
--
2.50.1
From 6ea39fcc82909b545087436ef3a1f87ddf362f40 Mon Sep 17 00:00:00 2001
From: ITotalJustice <[email protected]>
Date: Tue, 29 Jul 2025 13:28:39 +0100
Subject: [PATCH] fix poll
---
libctru/source/services/soc/soc_poll.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/libctru/source/services/soc/soc_poll.c b/libctru/source/services/soc/soc_poll.c
index 22cbe43..145fff2 100644
--- a/libctru/source/services/soc/soc_poll.c
+++ b/libctru/source/services/soc/soc_poll.c
@@ -27,11 +27,19 @@ int poll(struct pollfd *fds, nfds_t nfds, int timeout)
memcpy(tmp_fds, fds, sizeof(struct pollfd) * nfds);
for(i = 0; i < nfds; ++i) {
- tmp_fds[i].fd = soc_get_fd(fds[i].fd);
- if(tmp_fds[i].fd < 0) {
- errno = -tmp_fds[i].fd;
- free(tmp_fds);
- return -1;
+ if (fds[i].fd >= 0) {
+ tmp_fds[i].fd = soc_get_fd(fds[i].fd);
+ if(tmp_fds[i].fd < 0) {
+ errno = -tmp_fds[i].fd;
+ free(tmp_fds);
+ return -1;
+ }
+ }
+ // negative fds are ignored, however 3ds poll only
+ // ignores fd's that are -1.
+ // this forces negative fds to -1 so they are ignored without error.
+ else {
+ tmp_fds[i].fd = -1;
}
tmp_fds[i].revents = 0;
}
--
2.50.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment