From 8a8ce9743951659d64b88cc2e96f22cde8c2e131 Mon Sep 17 00:00:00 2001 From: John Sanpe Date: Tue, 11 Jun 2024 22:07:15 +0800 Subject: [PATCH] fixup usb: fixed open flags Signed-off-by: John Sanpe --- cmake/xdbd_config.h.in | 4 ++++ src/connection/usb/xdbd_connection_usb.c | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/cmake/xdbd_config.h.in b/cmake/xdbd_config.h.in index 0c7dcc6..04608af 100644 --- a/cmake/xdbd_config.h.in +++ b/cmake/xdbd_config.h.in @@ -11,6 +11,10 @@ #cmakedefine XDBD_CONFIG_WIN #cmakedefine XDBD_CONFIG_DEBUG_POOL +#if !defined(XDBD_CONFIG_LINUX) && !defined(XDBD_CONFIG_OSX) && !defined(XDBD_CONFIG_WIN) +# error "Unknow platform" +#endif + #define USB_ADB_PATH "/dev/adb/usb" #define USB_FFS_ADB_PATH "/dev/usb-ffs/adb/" diff --git a/src/connection/usb/xdbd_connection_usb.c b/src/connection/usb/xdbd_connection_usb.c index 7f272d1..0b8b848 100644 --- a/src/connection/usb/xdbd_connection_usb.c +++ b/src/connection/usb/xdbd_connection_usb.c @@ -185,7 +185,7 @@ int xdbd_open_usb_listening_sockets(xdbd_t *xdbd) { int xdbd_event_open_usb_connection(xdbd_usb_listening_t *uls) { - uls->fd_ctr = xdbd_open((char *)uls->ctr.data, 0); + uls->fd_ctr = xdbd_open((char *)uls->ctr.data, O_RDWR); if (uls->fd_ctr < 0) { bfdev_log_err("%s open failed: %m\n", uls->ctr.data); return XDBD_ERR; @@ -195,13 +195,13 @@ int xdbd_event_open_usb_connection(xdbd_usb_listening_t *uls) { return usb_init_send(uls); #endif - uls->fd_out = xdbd_open((char *)uls->out.data, 0); + uls->fd_out = xdbd_open((char *)uls->out.data, O_RDWR); if (uls->fd_out < 0) { bfdev_log_err("%s open failed: %m\n", uls->out.data); return XDBD_ERR; } - uls->fd_in = xdbd_open((char *)uls->in.data, 0); + uls->fd_in = xdbd_open((char *)uls->in.data, O_RDWR); if (uls->fd_in < 0) { bfdev_log_err("%s open failed: %m\n", uls->in.data); return XDBD_ERR;