diff options
Diffstat (limited to 'Source/Kernel/DeviceManager')
-rw-r--r-- | Source/Kernel/DeviceManager/Dev.ns.cpp | 14 | ||||
-rw-r--r-- | Source/Kernel/DeviceManager/Dev.ns.h | 1 | ||||
-rw-r--r-- | Source/Kernel/DeviceManager/Kbd.ns.cpp | 4 |
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; |