+unsigned GameController::detect()
+{
+ Private::detected_controllers.clear();
+
+ FS::Path dev_input = "/dev/input";
+ 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());
+
+ detect_done = true;
+ n_detected_controllers = Private::detected_controllers.size();
+
+ return Private::detected_controllers.size();
+}
+
+void GameController::use_event_dispatcher(IO::EventDispatcher *ed)
+{
+ if(event_disp)
+ event_disp->remove(*priv->dev);
+ event_disp = ed;
+ if(event_disp)
+ event_disp->add(*priv->dev);
+}
+