Date: Sat, 19 Nov 2016 12:39:44 -0800 From: David Shao <davshao@gmail.com> To: freebsd-x11@freebsd.org Subject: Re: Need ideas for updating devd.c patch for xserver 1.19 Message-ID: <CABZaEK6%2BRwzAjPxxzhuLKVjNXmoTzSiLg2waV5Sn80ap1PBuqQ@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
This patch is for pkgsrc. Something very similar should work for ports. The wakeup_handler() now does nothing. Instead a new callback devdInputHandlerNotify() using the same code that used to be called from wakeup_handler(), minus checking the fd_set, is provided to SetNotifyFd. Tested with xf86-video-ati 7.8.0. --- x11/modular-xorg-server.prev/patches/patch-config_devd.c 2015-07-29 21:59:49.000000000 -0700 +++ x11/modular-xorg-server/patches/patch-config_devd.c 2016-11-19 09:38:00.826168000 -0800 @@ -1,8 +1,8 @@ $NetBSD$ ---- config/devd.c.orig 2015-07-30 04:46:21.648387000 +0000 +--- config/devd.c.orig 2016-11-19 17:36:01.195812000 +0000 +++ config/devd.c -@@ -0,0 +1,535 @@ +@@ -0,0 +1,564 @@ +/* + * Copyright (c) 2012 Baptiste Daroussin + * Copyright (c) 2013, 2014 Alex Kozlov @@ -349,11 +349,14 @@ +disconnect_devd(int sock) +{ + if (sock >= 0) { -+ RemoveGeneralSocket(sock); ++ RemoveNotifyFd(sock); + close(sock); + } +} + ++static void ++devdInputHandlerNotify(int sock, int read, void *data); ++ +static int +connect_devd(void) +{ @@ -375,7 +378,7 @@ + return -1; + } + -+ AddGeneralSocket(sock); ++ SetNotifyFd(sock, devdInputHandlerNotify, X_NOTIFY_READ, NULL); + + return sock; +} @@ -450,15 +453,15 @@ +} + +static void -+wakeup_handler(void *data, int err, void *read_mask) ++wakeup_handler(void *data, int err) +{ ++/* + char *line = NULL; + char *walk; + + if (err < 0) + return; + -+ if (FD_ISSET(sock_devd, (fd_set *) read_mask)) { + if (socket_getline(sock_devd, &line) < 0) + return; + @@ -477,11 +480,37 @@ + break; + } + free(line); ++*/ ++} ++ ++static void ++devdInputHandlerNotify(int sock, int read, void *data) ++{ ++ char *line = NULL; ++ char *walk; ++ ++ if (socket_getline(sock, &line) < 0) ++ return; ++ ++ walk = strchr(line + 1, ' '); ++ if (walk != NULL) ++ walk[0] = '\0'; ++ ++ switch (*line) { ++ case DEVD_EVENT_ADD: ++ device_added(line + 1); ++ break; ++ case DEVD_EVENT_REMOVE: ++ device_removed(line + 1); ++ break; ++ default: ++ break; + } ++ free(line); +} + +static void -+block_handler(void *data, struct timeval **tv, void *read_mask) ++block_handler(void *data, struct timeval **tv) +{ +} +
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CABZaEK6%2BRwzAjPxxzhuLKVjNXmoTzSiLg2waV5Sn80ap1PBuqQ>