summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo@jmondi.org>2019-01-21 17:53:28 +0100
committerJacopo Mondi <jacopo@jmondi.org>2019-01-22 14:14:04 +0100
commit1af83ca6df779fc3c7f8f4fc48f3ca82d824987d (patch)
tree7f5530f4ea838b04f23a07bb40c371c2f65e586a
parentd18d25bde3064a537d4b080488941fffd61e1739 (diff)
libcamera: Global s/devnode/deviceNode rename
Do not use the abreviated version for members, variables and getter methods. Library-wise rename, no intended functional changes. Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
-rw-r--r--src/libcamera/device_enumerator.cpp28
-rw-r--r--src/libcamera/include/device_enumerator.h6
-rw-r--r--src/libcamera/include/media_device.h6
-rw-r--r--src/libcamera/include/media_object.h6
-rw-r--r--src/libcamera/include/v4l2_device.h4
-rw-r--r--src/libcamera/media_device.cpp14
-rw-r--r--src/libcamera/media_object.cpp14
-rw-r--r--src/libcamera/v4l2_device.cpp14
-rw-r--r--test/media_device/media_device_link_test.cpp2
-rw-r--r--test/media_device/media_device_print_test.cpp12
-rw-r--r--test/pipeline/ipu3/ipu3_pipeline_test.cpp4
11 files changed, 55 insertions, 55 deletions
diff --git a/src/libcamera/device_enumerator.cpp b/src/libcamera/device_enumerator.cpp
index 22d4edee..fcf71af6 100644
--- a/src/libcamera/device_enumerator.cpp
+++ b/src/libcamera/device_enumerator.cpp
@@ -189,18 +189,18 @@ DeviceEnumerator::~DeviceEnumerator()
/**
* \brief Add a media device to the enumerator
- * \param[in] devnode path to the media device to add
+ * \param[in] deviceNode path to the media device to add
*
- * Create a media device for the \a devnode, open it, populate its media graph,
+ * Create a media device for the \a deviceNode, open it, populate its media graph,
* and look up device nodes associated with all entities. Store the media device
* in the internal list for later matching with pipeline handlers.
*
* \return 0 on success, or a negative error code if the media device can't be
* created or populated
*/
-int DeviceEnumerator::addDevice(const std::string &devnode)
+int DeviceEnumerator::addDevice(const std::string &deviceNode)
{
- MediaDevice *media = new MediaDevice(devnode);
+ MediaDevice *media = new MediaDevice(deviceNode);
int ret = media->open();
if (ret < 0)
@@ -209,25 +209,25 @@ int DeviceEnumerator::addDevice(const std::string &devnode)
ret = media->populate();
if (ret < 0) {
LOG(DeviceEnumerator, Info)
- << "Unable to populate media device " << devnode
+ << "Unable to populate media device " << deviceNode
<< " (" << strerror(-ret) << "), skipping";
return ret;
}
LOG(DeviceEnumerator, Debug)
<< "New media device \"" << media->driver()
- << "\" created from " << devnode;
+ << "\" created from " << deviceNode;
/* Associate entities to device node paths. */
for (MediaEntity *entity : media->entities()) {
if (entity->deviceMajor() == 0 && entity->deviceMinor() == 0)
continue;
- std::string devnode = lookupDevnode(entity->deviceMajor(), entity->deviceMinor());
- if (devnode.empty())
+ std::string deviceNode = lookupDeviceNode(entity->deviceMajor(), entity->deviceMinor());
+ if (deviceNode.empty())
return -EINVAL;
- ret = entity->setDeviceNode(devnode);
+ ret = entity->setDeviceNode(deviceNode);
if (ret)
return ret;
}
@@ -267,7 +267,7 @@ MediaDevice *DeviceEnumerator::search(const DeviceMatch &dm)
}
/**
- * \fn DeviceEnumerator::lookupDevnode(int major, int minor)
+ * \fn DeviceEnumerator::lookupDeviceNode(int major, int minor)
* \brief Lookup device node path from device number
* \param major The device major number
* \param minor The device minor number
@@ -358,12 +358,12 @@ done:
return ret >= 0 ? 0 : ret;
}
-std::string DeviceEnumeratorUdev::lookupDevnode(int major, int minor)
+std::string DeviceEnumeratorUdev::lookupDeviceNode(int major, int minor)
{
struct udev_device *device;
const char *name;
dev_t devnum;
- std::string devnode = std::string();
+ std::string deviceNode = std::string();
devnum = makedev(major, minor);
device = udev_device_new_from_devnum(udev_, 'c', devnum);
@@ -372,11 +372,11 @@ std::string DeviceEnumeratorUdev::lookupDevnode(int major, int minor)
name = udev_device_get_devnode(device);
if (name)
- devnode = name;
+ deviceNode = name;
udev_device_unref(device);
- return devnode;
+ return deviceNode;
}
} /* namespace libcamera */
diff --git a/src/libcamera/include/device_enumerator.h b/src/libcamera/include/device_enumerator.h
index c5541c5f..40c7750b 100644
--- a/src/libcamera/include/device_enumerator.h
+++ b/src/libcamera/include/device_enumerator.h
@@ -45,12 +45,12 @@ public:
MediaDevice *search(const DeviceMatch &dm);
protected:
- int addDevice(const std::string &devnode);
+ int addDevice(const std::string &deviceNode);
private:
std::vector<MediaDevice *> devices_;
- virtual std::string lookupDevnode(int major, int minor) = 0;
+ virtual std::string lookupDeviceNode(int major, int minor) = 0;
};
class DeviceEnumeratorUdev: public DeviceEnumerator
@@ -65,7 +65,7 @@ public:
private:
struct udev *udev_;
- std::string lookupDevnode(int major, int minor) final;
+ std::string lookupDeviceNode(int major, int minor) final;
};
} /* namespace libcamera */
diff --git a/src/libcamera/include/media_device.h b/src/libcamera/include/media_device.h
index a8dec0d3..ba3046dd 100644
--- a/src/libcamera/include/media_device.h
+++ b/src/libcamera/include/media_device.h
@@ -21,7 +21,7 @@ namespace libcamera {
class MediaDevice
{
public:
- MediaDevice(const std::string &devnode);
+ MediaDevice(const std::string &deviceNode);
~MediaDevice();
bool acquire();
@@ -35,7 +35,7 @@ public:
bool valid() const { return valid_; }
const std::string driver() const { return driver_; }
- const std::string devnode() const { return devnode_; }
+ const std::string deviceNode() const { return deviceNode_; }
const std::vector<MediaEntity *> &entities() const { return entities_; }
MediaEntity *getEntityByName(const std::string &name) const;
@@ -49,7 +49,7 @@ public:
private:
std::string driver_;
- std::string devnode_;
+ std::string deviceNode_;
int fd_;
bool valid_;
bool acquired_;
diff --git a/src/libcamera/include/media_object.h b/src/libcamera/include/media_object.h
index fad55a06..64095bec 100644
--- a/src/libcamera/include/media_object.h
+++ b/src/libcamera/include/media_object.h
@@ -85,7 +85,7 @@ class MediaEntity : public MediaObject
public:
const std::string &name() const { return name_; }
unsigned int function() const { return function_; }
- const std::string &devnode() const { return devnode_; }
+ const std::string &deviceNode() const { return deviceNode_; }
unsigned int deviceMajor() const { return major_; }
unsigned int deviceMinor() const { return minor_; }
@@ -94,7 +94,7 @@ public:
const MediaPad *getPadByIndex(unsigned int index) const;
const MediaPad *getPadById(unsigned int id) const;
- int setDeviceNode(const std::string &devnode);
+ int setDeviceNode(const std::string &deviceNode);
private:
friend class MediaDevice;
@@ -106,7 +106,7 @@ private:
std::string name_;
unsigned int function_;
- std::string devnode_;
+ std::string deviceNode_;
unsigned int major_;
unsigned int minor_;
diff --git a/src/libcamera/include/v4l2_device.h b/src/libcamera/include/v4l2_device.h
index c6f3d9a0..b92e1f1c 100644
--- a/src/libcamera/include/v4l2_device.h
+++ b/src/libcamera/include/v4l2_device.h
@@ -36,7 +36,7 @@ class MediaEntity;
class V4L2Device
{
public:
- explicit V4L2Device(const std::string &devnode);
+ explicit V4L2Device(const std::string &deviceNode);
explicit V4L2Device(const MediaEntity &entity);
V4L2Device(const V4L2Device &) = delete;
~V4L2Device();
@@ -52,7 +52,7 @@ public:
const char *busName() const { return caps_.bus_info(); }
private:
- std::string devnode_;
+ std::string deviceNode_;
int fd_;
V4L2Capability caps_;
};
diff --git a/src/libcamera/media_device.cpp b/src/libcamera/media_device.cpp
index eb2e68bb..81c6a773 100644
--- a/src/libcamera/media_device.cpp
+++ b/src/libcamera/media_device.cpp
@@ -63,13 +63,13 @@ LOG_DEFINE_CATEGORY(MediaDevice)
/**
* \brief Construct a MediaDevice
- * \param devnode The media device node path
+ * \param deviceNode The media device node path
*
* Once constructed the media device is invalid, and must be opened and
* populated with open() and populate() before the media graph can be queried.
*/
-MediaDevice::MediaDevice(const std::string &devnode)
- : devnode_(devnode), fd_(-1), valid_(false), acquired_(false)
+MediaDevice::MediaDevice(const std::string &deviceNode)
+ : deviceNode_(deviceNode), fd_(-1), valid_(false), acquired_(false)
{
}
@@ -145,12 +145,12 @@ int MediaDevice::open()
return -EBUSY;
}
- int ret = ::open(devnode_.c_str(), O_RDWR);
+ int ret = ::open(deviceNode_.c_str(), O_RDWR);
if (ret < 0) {
ret = -errno;
LOG(MediaDevice, Error)
<< "Failed to open media device at "
- << devnode_ << ": " << strerror(-ret);
+ << deviceNode_ << ": " << strerror(-ret);
return ret;
}
fd_ = ret;
@@ -285,9 +285,9 @@ int MediaDevice::populate()
*/
/**
- * \fn MediaDevice::devnode()
+ * \fn MediaDevice::deviceNode()
* \brief Retrieve the media device device node path
- * \return The MediaDevice devnode path
+ * \return The MediaDevice deviceNode path
*/
/**
diff --git a/src/libcamera/media_object.cpp b/src/libcamera/media_object.cpp
index a8d92e5f..baf9aeaa 100644
--- a/src/libcamera/media_object.cpp
+++ b/src/libcamera/media_object.cpp
@@ -246,7 +246,7 @@ void MediaPad::addLink(MediaLink *link)
*
* In addition to their graph id, media graph entities are identified by a
* name() unique in the media device context. They implement a function() and
- * may expose a devnode().
+ * may expose a deviceNode().
*/
/**
@@ -266,7 +266,7 @@ void MediaPad::addLink(MediaLink *link)
*/
/**
- * \fn MediaEntity::devnode()
+ * \fn MediaEntity::deviceNode()
* \brief Retrieve the entity's device node path, if any
*
* \sa int setDeviceNode()
@@ -326,23 +326,23 @@ const MediaPad *MediaEntity::getPadById(unsigned int id) const
/**
* \brief Set the path to the device node for the associated interface
- * \param devnode The interface device node path associated with this entity
+ * \param deviceNode The interface device node path associated with this entity
* \return 0 on success, or a negative error code if the device node can't be
* accessed
*/
-int MediaEntity::setDeviceNode(const std::string &devnode)
+int MediaEntity::setDeviceNode(const std::string &deviceNode)
{
/* Make sure the device node can be accessed. */
- int ret = ::access(devnode.c_str(), R_OK | W_OK);
+ int ret = ::access(deviceNode.c_str(), R_OK | W_OK);
if (ret < 0) {
ret = -errno;
LOG(MediaDevice, Error)
- << "Device node " << devnode << " can't be accessed: "
+ << "Device node " << deviceNode << " can't be accessed: "
<< strerror(-ret);
return ret;
}
- devnode_ = devnode;
+ deviceNode_ = deviceNode;
return 0;
}
diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp
index 5809fc62..2b17fa1e 100644
--- a/src/libcamera/v4l2_device.cpp
+++ b/src/libcamera/v4l2_device.cpp
@@ -88,10 +88,10 @@ LOG_DEFINE_CATEGORY(V4L2)
/**
* \brief Construct a V4L2Device
- * \param devnode The file-system path to the video device node
+ * \param deviceNode The file-system path to the video device node
*/
-V4L2Device::V4L2Device(const std::string &devnode)
- : devnode_(devnode), fd_(-1)
+V4L2Device::V4L2Device(const std::string &deviceNode)
+ : deviceNode_(deviceNode), fd_(-1)
{
}
@@ -102,7 +102,7 @@ V4L2Device::V4L2Device(const std::string &devnode)
* Construct a V4L2Device from a MediaEntity's device node path.
*/
V4L2Device::V4L2Device(const MediaEntity &entity)
- : V4L2Device(entity.devnode())
+ : V4L2Device(entity.deviceNode())
{
}
@@ -124,11 +124,11 @@ int V4L2Device::open()
return -EBUSY;
}
- ret = ::open(devnode_.c_str(), O_RDWR);
+ ret = ::open(deviceNode_.c_str(), O_RDWR);
if (ret < 0) {
ret = -errno;
LOG(V4L2, Error)
- << "Failed to open V4L2 device '" << devnode_
+ << "Failed to open V4L2 device '" << deviceNode_
<< "': " << strerror(-ret);
return ret;
}
@@ -144,7 +144,7 @@ int V4L2Device::open()
}
LOG(V4L2, Debug)
- << "Opened '" << devnode_ << "' "
+ << "Opened '" << deviceNode_ << "' "
<< caps_.bus_info() << ": " << caps_.driver()
<< ": " << caps_.card();
diff --git a/test/media_device/media_device_link_test.cpp b/test/media_device/media_device_link_test.cpp
index 2297e335..ac5b632f 100644
--- a/test/media_device/media_device_link_test.cpp
+++ b/test/media_device/media_device_link_test.cpp
@@ -55,7 +55,7 @@ class MediaDeviceLinkTest : public Test
if (dev_->open()) {
cerr << "Failed to open media device at "
- << dev_->devnode() << endl;
+ << dev_->deviceNode() << endl;
return TestFail;
}
diff --git a/test/media_device/media_device_print_test.cpp b/test/media_device/media_device_print_test.cpp
index 13af722a..3eef9739 100644
--- a/test/media_device/media_device_print_test.cpp
+++ b/test/media_device/media_device_print_test.cpp
@@ -35,7 +35,7 @@ protected:
void cleanup() { }
private:
- int testMediaDevice(string devnode);
+ int testMediaDevice(string deviceNode);
void printMediaGraph(const MediaDevice &media, ostream &os);
void printLinkFlags(const MediaLink *link, ostream &os);
@@ -68,7 +68,7 @@ void MediaDevicePrintTest::printLinkFlags(const MediaLink *link, ostream &os)
*/
void MediaDevicePrintTest::printMediaGraph(const MediaDevice &media, ostream &os)
{
- os << "\n" << media.driver() << " - " << media.devnode() << "\n\n";
+ os << "\n" << media.driver() << " - " << media.deviceNode() << "\n\n";
for (auto const &entity : media.entities()) {
os << "\"" << entity->name() << "\"\n";
@@ -108,9 +108,9 @@ void MediaDevicePrintTest::printMediaGraph(const MediaDevice &media, ostream &os
}
/* Test a single media device. */
-int MediaDevicePrintTest::testMediaDevice(const string devnode)
+int MediaDevicePrintTest::testMediaDevice(const string deviceNode)
{
- MediaDevice dev(devnode);
+ MediaDevice dev(deviceNode);
int ret;
/* Fuzzy open/close sequence. */
@@ -144,7 +144,7 @@ int MediaDevicePrintTest::testMediaDevice(const string devnode)
#define MAX_MEDIA_DEV 256
int MediaDevicePrintTest::run()
{
- const string devnode("/dev/media");
+ const string deviceNode("/dev/media");
unsigned int i;
int ret = 77; /* skip test exit code */
@@ -153,7 +153,7 @@ int MediaDevicePrintTest::run()
* system, if any.
*/
for (i = 0; i < MAX_MEDIA_DEV; i++) {
- string mediadev = devnode + to_string(i);
+ string mediadev = deviceNode + to_string(i);
struct stat pstat = { };
if (stat(mediadev.c_str(), &pstat))
diff --git a/test/pipeline/ipu3/ipu3_pipeline_test.cpp b/test/pipeline/ipu3/ipu3_pipeline_test.cpp
index 5dbf0206..482c1249 100644
--- a/test/pipeline/ipu3/ipu3_pipeline_test.cpp
+++ b/test/pipeline/ipu3/ipu3_pipeline_test.cpp
@@ -72,7 +72,7 @@ int IPU3PipelineTest::init()
}
if (cio2->open()) {
- cerr << "Failed to open media device " << cio2->devnode() << endl;
+ cerr << "Failed to open media device " << cio2->deviceNode() << endl;
return TestFail;
}
@@ -84,7 +84,7 @@ int IPU3PipelineTest::init()
*/
int ret = cio2->populate();
if (ret) {
- cerr << "Failed to populate media device " << cio2->devnode() << endl;
+ cerr << "Failed to populate media device " << cio2->deviceNode() << endl;
return TestFail;
}