Merge branch 'master' into pico_sdk

This commit is contained in:
2026-03-29 12:28:36 +03:00
359 changed files with 56129 additions and 6404 deletions

View File

@@ -131,6 +131,10 @@ bool PIHIDevice::open(const PIHIDeviceInfo & device) {
return false;
}
HidD_GetPreparsedData(PRIVATE->deviceHandle, &PRIVATE->preparsed);
if (!PRIVATE->preparsed) {
close();
return false;
}
return true;
#endif
}
@@ -347,12 +351,12 @@ PIVector<PIHIDeviceInfo> PIHIDevice::allDevices(bool try_open) {
PIDir hid_dir("/sys/bus/hid/devices"_a);
auto hid_devs = hid_dir.entries();
for (auto hd: hid_devs) {
for (const auto & hd: hid_devs) {
// piCout << d.path;
if (!isDir(hd)) continue;
PIDir dir_input(hd.path + "/input"_a);
auto hid_inputs = dir_input.entries();
for (auto hd_i: hid_inputs) {
for (const auto & hd_i: hid_inputs) {
if (!isDir(hd_i)) continue;
// now in /sys/bus/hid/devices/<dev>/input/input<N>
// piCout << hd_i.path;
@@ -369,7 +373,7 @@ PIVector<PIHIDeviceInfo> PIHIDevice::allDevices(bool try_open) {
PIDir dir_e(hd_i.path);
PIStringList devs;
auto dl_e = dir_e.entries();
for (auto d_e: dl_e) {
for (const auto & d_e: dl_e) {
if (!d_e.isDir() || d_e.flags[PIFile::FileInfo::Dot] || d_e.flags[PIFile::FileInfo::DotDot]) continue;
devs << d_e.name();
}
@@ -397,7 +401,7 @@ PIVector<PIHIDeviceInfo> PIHIDevice::allDevices(bool try_open) {
if (test_f.isClosed()) continue;
}
ullong ev = readFile(hd_i.path + "/capabilities/ev"_a).toULLong(16);
// ullong ev = readFile(hd_i.path + "/capabilities/ev"_a).toULLong(16);
auto readAxes = [readFile, checkBit, &hd_i, &dev](const PIString & file, bool is_relative) {
PIVector<PIHIDeviceInfo::AxisInfo> ret;
@@ -547,6 +551,7 @@ PIVector<PIHIDeviceInfo> PIHIDevice::allDevices(bool try_open) {
PHIDP_PREPARSED_DATA preparsed = nullptr;
if (HidD_GetPreparsedData(deviceHandle, &preparsed) == FALSE) {
piCout << "HidD_GetPreparsedData error:" << errorString();
CloseHandle(deviceHandle);
continue;
}
// auto pp = PIByteArray(preparsed, 64);