summaryrefslogtreecommitdiff
path: root/Source/Kernel/DeviceManager
diff options
context:
space:
mode:
authorAlexis211 <alexis211@gmail.com>2009-09-26 22:17:03 +0200
committerAlexis211 <alexis211@gmail.com>2009-09-26 22:17:03 +0200
commit021831ab981b9df22cd1ac5e5ac51f0f84ef49a7 (patch)
tree90e9eeab0c0f72d65ba4e4ac6a798aa2ae05d7b3 /Source/Kernel/DeviceManager
parent5d7ad3933bc2de69c2b7d09791adf305de019d8a (diff)
downloadMelon-021831ab981b9df22cd1ac5e5ac51f0f84ef49a7.tar.gz
Melon-021831ab981b9df22cd1ac5e5ac51f0f84ef49a7.zip
Nothing intresting
Diffstat (limited to 'Source/Kernel/DeviceManager')
-rw-r--r--Source/Kernel/DeviceManager/Dev.ns.cpp14
-rw-r--r--Source/Kernel/DeviceManager/Dev.ns.h1
-rw-r--r--Source/Kernel/DeviceManager/Kbd.ns.cpp4
3 files changed, 18 insertions, 1 deletions
diff --git a/Source/Kernel/DeviceManager/Dev.ns.cpp b/Source/Kernel/DeviceManager/Dev.ns.cpp
index b2f8a70..3afc267 100644
--- a/Source/Kernel/DeviceManager/Dev.ns.cpp
+++ b/Source/Kernel/DeviceManager/Dev.ns.cpp
@@ -48,4 +48,18 @@ Vector<Device*> findDevices(String _class) {
return ret;
}
+Device* findDevice(String _class, u32int idx) {
+ for (u32int i = 0; i < devices.size(); i++) {
+ String devclass = devices[i]->getClass();
+ if (devclass == _class or (devclass.size() > _class.size() and devclass.substr(0, _class.size()) == _class)) {
+ if (idx == 0) {
+ return devices[i];
+ } else {
+ idx--;
+ }
+ }
+ }
+ return NULL;
+}
+
}
diff --git a/Source/Kernel/DeviceManager/Dev.ns.h b/Source/Kernel/DeviceManager/Dev.ns.h
index 389fe3e..7dda56b 100644
--- a/Source/Kernel/DeviceManager/Dev.ns.h
+++ b/Source/Kernel/DeviceManager/Dev.ns.h
@@ -13,6 +13,7 @@ namespace Dev {
bool requestIRQ(Device* dev, int irq);
Vector<Device*> findDevices(String _class = "");
+ Device* findDevice(String _class = "", u32int idx = 0);
}
#endif
diff --git a/Source/Kernel/DeviceManager/Kbd.ns.cpp b/Source/Kernel/DeviceManager/Kbd.ns.cpp
index df419b7..3db0d34 100644
--- a/Source/Kernel/DeviceManager/Kbd.ns.cpp
+++ b/Source/Kernel/DeviceManager/Kbd.ns.cpp
@@ -69,7 +69,9 @@ bool loadKeymap(String lang) {
File f(file, FM_READ);
if (!f.valid()) return false;
- f.read(sizeof(melon_keymap_t), (u8int*)&km);
+ if (!f.read<melon_keymap_t> (&km)) {
+ Log::log(KL_WARNING, String("Kbd.ns : keymap badly loaded : ") += file);
+ }
keymapNormal = km.normal;
if (km.shift[0x10] != 0) keymapShift = km.shift; else keymapShift = keymapNormal;