mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-23 00:04:02 -04:00
AP_HAL_Linux: move dirname to I2CDevice core
All entries would need the "devices/" prefix and it's more natural not using it.
This commit is contained in:
parent
f8c3ceca3a
commit
6a6175df1c
@ -55,9 +55,9 @@ static I2CDriver i2cDriver0(2);
|
||||
#elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_MINLURE
|
||||
static const std::vector<const char *> i2c_devpaths({
|
||||
/* UEFI with lpss set to ACPI */
|
||||
"/devices/platform/80860F41:05",
|
||||
"platform/80860F41:05",
|
||||
/* UEFI with lpss set to PCI */
|
||||
"/devices/pci0000:00/0000:00:18.6",
|
||||
"pci0000:00/0000:00:18.6",
|
||||
});
|
||||
static I2CDriver i2cDriver0(i2c_devpaths);
|
||||
/* One additional emulated bus */
|
||||
|
@ -223,7 +223,7 @@ I2CDeviceManager::I2CDeviceManager()
|
||||
AP_HAL::OwnPtr<AP_HAL::I2CDevice>
|
||||
I2CDeviceManager::get_device(std::vector<const char *> devpaths, uint8_t address)
|
||||
{
|
||||
const char *dirname = "/sys/class/i2c-dev";
|
||||
const char *dirname = "/sys/class/i2c-dev/";
|
||||
struct dirent *de = nullptr;
|
||||
DIR *d;
|
||||
|
||||
@ -245,7 +245,7 @@ I2CDeviceManager::get_device(std::vector<const char *> devpaths, uint8_t address
|
||||
}
|
||||
|
||||
abs_str_device = realpath(str_device, nullptr);
|
||||
if (!abs_str_device || !(p = startswith(abs_str_device, "/sys"))) {
|
||||
if (!abs_str_device || !(p = startswith(abs_str_device, "/sys/devices/"))) {
|
||||
free(abs_str_device);
|
||||
free(str_device);
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user