summaryrefslogtreecommitdiff
path: root/Kernel/Devices/SerialDevice.cpp
diff options
context:
space:
mode:
authorJean-Baptiste Boric <jblbeurope@gmail.com>2021-01-21 18:49:56 +0100
committerAndreas Kling <kling@serenityos.org>2021-01-22 22:17:39 +0100
commitf64e287b82fceb81c843bdaf6bad4e608330ae60 (patch)
treec7e326d98481975f97eac54c91bc7d9f24770e9f /Kernel/Devices/SerialDevice.cpp
parenta2601e13088d61b796220dbb1085ec74a3f6d9fd (diff)
downloadserenity-f64e287b82fceb81c843bdaf6bad4e608330ae60.zip
Kernel: Make device generate their own names
Besides removing the monolithic DevFSDeviceInode::determine_name() method, being able to determine a device's name inside the /dev hierarchy outside of DevFS has its uses.
Diffstat (limited to 'Kernel/Devices/SerialDevice.cpp')
-rw-r--r--Kernel/Devices/SerialDevice.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/Kernel/Devices/SerialDevice.cpp b/Kernel/Devices/SerialDevice.cpp
index 9801c6b83d..ef60b42d6b 100644
--- a/Kernel/Devices/SerialDevice.cpp
+++ b/Kernel/Devices/SerialDevice.cpp
@@ -87,6 +87,11 @@ KResultOr<size_t> SerialDevice::write(FileDescription&, size_t, const UserOrKern
return (size_t)nread;
}
+String SerialDevice::device_name() const
+{
+ return String::formatted("ttyS{}", minor() - 64);
+}
+
void SerialDevice::initialize()
{
set_interrupts(0);