Try MICRO_PIP fixes via opencode

This commit is contained in:
2026-03-29 11:21:12 +03:00
parent c60a682279
commit 15f90d9e17
8 changed files with 251 additions and 13 deletions

View File

@@ -7,12 +7,21 @@
# include "pifile.h"
# include "piiostream.h"
# include <fcntl.h>
# include <linux/input-event-codes.h>
# include <linux/input.h>
# include <sys/ioctl.h>
# include <sys/time.h>
# include <unistd.h>
# ifdef LINUX
# include <fcntl.h>
# include <linux/input-event-codes.h>
# include <linux/input.h>
# include <sys/ioctl.h>
# include <sys/time.h>
# include <unistd.h>
# else
// Stubs for embedded/non-Linux builds
# define EV_SYN 0
# define EV_KEY 1
# define EV_REL 2
# define EV_ABS 3
# define EVIOCGABS(_v) 0
# endif
#else
// clang-format off
# undef _WIN32_WINNT
@@ -395,6 +404,7 @@ PIVector<PIHIDeviceInfo> PIHIDevice::allDevices(bool try_open) {
ullong bits = readFile(hd_i.path + file).toULLong(16);
// piCout<< PICoutManipulators::Bin << abs;
if (bits > 0) {
#ifdef LINUX
int fd = ::open(dev.path.dataAscii(), O_RDONLY);
if (fd < 0) {
// piCout << "Warning: can`t open" << dev.path << errorString();
@@ -419,6 +429,19 @@ PIVector<PIHIDeviceInfo> PIHIDevice::allDevices(bool try_open) {
}
}
if (fd >= 0) ::close(fd);
#else
// Stub implementation for non-Linux builds
PIHIDeviceInfo::AxisInfo ai;
ai.is_relative = is_relative;
ai.min = 0;
ai.max = 1024;
for (int bit = 0; bit < 64; ++bit) {
if (checkBit(bits, bit, PIString::fromNumber(bit))) {
ai.data_index = bit;
ret << ai;
}
}
#endif
}
return ret;
};