]> git.tdb.fi Git - libs/gui.git/blobdiff - source/input/linux/gamecontroller.cpp
Automatically break into debugger on Vulkan errors
[libs/gui.git] / source / input / linux / gamecontroller.cpp
index 38d9d2b222901ab6d6fd69462035655f7efb4c77..f0139e96baeb4b04f150bf463c5fa7f84701a83f 100644 (file)
@@ -1,5 +1,6 @@
 #include <fcntl.h>
 #include <linux/joystick.h>
+#include <msp/core/algorithm.h>
 #include <msp/core/systemerror.h>
 #include <msp/fs/dir.h>
 #include <msp/io/handle_private.h>
@@ -42,9 +43,9 @@ unsigned GameController::detect()
        Private::detected_controllers.clear();
 
        FS::Path dev_input = "/dev/input";
-       list<string> devices = FS::list_filtered(dev_input, "^js[0-9]+");
-       devices.sort();
-       for(list<string>::const_iterator i=devices.begin(); i!=devices.end(); ++i)
+       vector<string> devices = FS::list_filtered(dev_input, "^js[0-9]+");
+       sort(devices);
+       for(vector<string>::const_iterator i=devices.begin(); i!=devices.end(); ++i)
                // TODO check permissions
                Private::detected_controllers.push_back((dev_input / *i).str());
 
@@ -122,12 +123,12 @@ string JsDevice::get_name() const
        return buf;
 }
 
-unsigned JsDevice::do_read(char *buf, unsigned size)
+size_t JsDevice::do_read(char *buf, size_t size)
 {
        return IO::sys_read(handle, buf, size);
 }
 
-unsigned JsDevice::do_write(const char *, unsigned)
+size_t JsDevice::do_write(const char *, size_t)
 {
        throw IO::invalid_access(IO::M_WRITE);
 }