libcamera/include/libcamera/internal/sysfs.h
Niklas Söderlund 39efe73774 libcamera: sysfs: Add helper to lookup device firmware node path
A system's firmware description is recorded differently in sysfs
depending if the system uses DT or ACPI. Add a helper to abstract
this, allowing users not to care which of the two are used.

For DT-based systems, the path is the full name of the DT node that
represents the device. For ACPI-based systems, the path is the absolute
namespace path to the ACPI object that represents the device. In both
cases, the path is guaranteed to be unique and persistent as long as the
system firmware is not modified.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-08-05 20:07:13 +02:00

24 lines
508 B
C++

/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2020, Google Inc.
*
* sysfs.h - Miscellaneous utility functions to access sysfs
*/
#ifndef __LIBCAMERA_INTERNAL_SYSFS_H__
#define __LIBCAMERA_INTERNAL_SYSFS_H__
#include <string>
namespace libcamera {
namespace sysfs {
std::string charDevPath(const std::string &deviceNode);
std::string firmwareNodePath(const std::string &device);
} /* namespace sysfs */
} /* namespace libcamera */
#endif /* __LIBCAMERA_INTERNAL_SYSFS_H__ */