mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-21 22:05:59 +00:00
fix(input): Steam finds a DualShock or DualSense chosen mid-session (#2942)
* fix(input): Steam finds a DualShock or DualSense chosen mid-session Android lets an app open a uevent netlink socket but not join its multicast groups, and libudev joins none when no udev daemon runs, so the udev monitors Steam's SDL opens heard nothing and the pad switch's add and remove events reached no one. SDL only noticed a new PlayStation pad when the old one happened to fail a read. A monitor left without a subscription is now swapped for the session's stand-in under the same descriptor, so it receives the injected events. * test(preload): stub the udev monitor bind hook in the CDP guard build
This commit is contained in:
1 parent
d5c83eae15
commit
d7f43c26cd
4 files changed
+151
-1
No files matched your search
@@ -111,6 +111,9 @@ typedef int (*accept4_fn)(int, struct sockaddr *, socklen_t *, int);
|
||||
static unsigned guarded_port(void);
|
||||
|
||||
__attribute__((visibility("hidden"))) int dd_udevmon_stand_in(int fd);
|
||||
__attribute__((visibility("hidden"))) int dd_udevmon_bind(int fd, const struct sockaddr *addr, socklen_t len,
|
||||
int (*real_bind)(int, const struct sockaddr *, socklen_t),
|
||||
int *rc);
|
||||
__attribute__((visibility("hidden"))) int dd_nl_bind(int fd, const struct sockaddr *addr,
|
||||
socklen_t len, int *rc);
|
||||
__attribute__((visibility("hidden"))) int dd_nl_connect(int fd, const struct sockaddr *addr,
|
||||
@@ -121,6 +124,7 @@ int bind(int fd, const struct sockaddr *addr, socklen_t len) {
|
||||
int nl_rc;
|
||||
if (!real) real = (bind_fn)dlsym(RTLD_NEXT, "bind");
|
||||
if (dd_nl_bind(fd, addr, len, &nl_rc)) return nl_rc;
|
||||
if (dd_udevmon_bind(fd, addr, len, real, &nl_rc)) return nl_rc;
|
||||
if (dd_udevmon_stand_in(fd)) {
|
||||
if (addr == NULL || len < sizeof(struct sockaddr_nl) || addr->sa_family != AF_NETLINK) {
|
||||
errno = EINVAL;
|
||||
|
||||
Reference in new issue
Block a user