diff --git a/CMakeLists.txt b/CMakeLists.txt index 0174ee2..de4706a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -77,13 +77,10 @@ else(NOT GEKKO) lib/x11/ApplicationWayland.hpp lib/x11/WindowXlib.cpp lib/x11/WindowWayland.cpp - lib/inputdev/HIDListenerUdev.cpp - lib/inputdev/HIDDeviceUdev.cpp lib/graphicsdev/GL.cpp lib/graphicsdev/GLX.cpp lib/graphicsdev/glew.c lib/audiodev/ALSA.cpp) - # list(APPEND PLAT_HDRS ) find_package(PkgConfig) @@ -109,6 +106,7 @@ else(NOT GEKKO) PATHS # TODO use CMAKE_SYSTEM_PROCESSOR or similar? /usr/lib/dbus-1.0/include + /usr/local/lib/dbus-1.0/include PATH_SUFFIXES dbus-1.0/include/) @@ -127,7 +125,18 @@ else(NOT GEKKO) endif() include_directories(${DBUS_INCLUDE_DIR} ${DBUS_ARCH_INCLUDE_DIR}) - list(APPEND _BOO_SYS_LIBS X11 Xi GL ${DBUS_LIBRARY} udev pthread) + list(APPEND _BOO_SYS_LIBS X11 Xi GL ${DBUS_LIBRARY} pthread) + + if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") + list(APPEND PLAT_SRCS + lib/inputdev/HIDListenerUdev.cpp + lib/inputdev/HIDDeviceUdev.cpp) + list(APPEND _BOO_SYS_LIBS udev) + else() + list(APPEND PLAT_SRCS + lib/inputdev/HIDListenerBSD.cpp + lib/inputdev/HIDDeviceBSD.cpp) + endif() endif() diff --git a/lib/inputdev/HIDDeviceBSD.cpp b/lib/inputdev/HIDDeviceBSD.cpp new file mode 100644 index 0000000..947f842 --- /dev/null +++ b/lib/inputdev/HIDDeviceBSD.cpp @@ -0,0 +1,31 @@ +#include "boo/inputdev/IHIDListener.hpp" +#include "boo/inputdev/DeviceFinder.hpp" + + +namespace boo +{ + +class HIDListenerBSD final : public IHIDListener +{ + DeviceFinder& m_finder; +public: + HIDListenerBSD(DeviceFinder& finder) + : m_finder(finder) + { + } + + ~HIDListenerBSD() + { + } + + bool startScanning() { return false; } + bool stopScanning() { return false; } + + bool scanNow() { return false; } +}; + +IHIDListener* IHIDListenerNew(DeviceFinder &finder) +{ + return new HIDListenerBSD(finder); +} +} diff --git a/lib/inputdev/HIDListenerBSD.cpp b/lib/inputdev/HIDListenerBSD.cpp new file mode 100644 index 0000000..dc1b2b1 --- /dev/null +++ b/lib/inputdev/HIDListenerBSD.cpp @@ -0,0 +1,34 @@ +#include "IHIDDevice.hpp" +#include "boo/inputdev/DeviceToken.hpp" +#include "boo/inputdev/DeviceBase.hpp" + +namespace boo +{ + +class HIDDeviceBSD final : public IHIDDevice +{ + DeviceToken& m_token; + DeviceBase& m_devImp; + + void _deviceDisconnected() {} + bool _sendUSBInterruptTransfer(const uint8_t* data, size_t length) { return false; } + size_t _receiveUSBInterruptTransfer(uint8_t* data, size_t length) { return 0; } + bool _sendHIDReport(const uint8_t* data, size_t length, uint16_t message) { return false; } + size_t _recieveReport(const uint8_t* data, size_t length, uint16_t message) {return 0; } +public: + HIDDeviceBSD(DeviceToken& token, DeviceBase& devImp) + : m_token(token), + m_devImp(devImp) + { + } + + ~HIDDeviceBSD() + { + } +}; + +IHIDDevice* IHIDDeviceNew(DeviceToken& token, DeviceBase& devImp) +{ + return new HIDDeviceBSD(token, devImp); +} +} diff --git a/lib/x11/ApplicationXlib.hpp b/lib/x11/ApplicationXlib.hpp index 668ff01..a649154 100644 --- a/lib/x11/ApplicationXlib.hpp +++ b/lib/x11/ApplicationXlib.hpp @@ -9,12 +9,14 @@ #include #include #include +#include #include DBusConnection* RegisterDBus(const char* appName, bool& isFirst); #include +#include #include #include #include