From b943c59f3575ee357b66cc316baec95ffcfd5f10 Mon Sep 17 00:00:00 2001 From: Dominik Riebeling Date: Wed, 18 Sep 2013 22:06:41 +0200 Subject: Rework autodetection to better handle ambiguous cases. The old detection code simply assumed only one player to be connected and threw all information it could find together, causing wrong results in various cases. Rewrite it to better handle this. - Don't expect only a single player to be attached. Return a list of players found instead. The configuration dialog can then show the user a list to select from. This is not implemented yet, the configuration dialog will only show the devices found and tell the user to disconnect all but one. - Handle ambiguous cases better. A player found that is ambiguous is treated as such, and if refining the result didn't lead to a single match for each possible player a single entry is created that indicates it being ambiguous. The current code needs a bit of additional cleanup (the result exposes internal data to the caller it shouldn't) to be done later. Change-Id: I22dc2f73cdd6a9d90c34f3a0703aa9e0a2d2087a --- rbutil/rbutilqt/base/autodetection.h | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'rbutil/rbutilqt/base/autodetection.h') diff --git a/rbutil/rbutilqt/base/autodetection.h b/rbutil/rbutilqt/base/autodetection.h index 65a24abb8f..c3c7fc9168 100644 --- a/rbutil/rbutilqt/base/autodetection.h +++ b/rbutil/rbutilqt/base/autodetection.h @@ -25,6 +25,7 @@ #include #include #include +#include class Autodetection :public QObject { @@ -39,29 +40,29 @@ public: PlayerMtpMode, PlayerWrongFilesystem, PlayerError, + PlayerAmbiguous, }; struct Detected { QString device; + QStringList usbdevices; QString mountpoint; enum PlayerStatus status; }; bool detect(); - QList detected(void); + QList detected(void) { return m_detected; } private: QString resolveMountPoint(QString); - bool detectUsb(void); - bool detectAjbrec(QString); + void detectUsb(void); + void mergeMounted(void); + void mergePatcher(void); + QString detectAjbrec(QString); + int findDetectedDevice(QString device); QList m_detected; - QString m_device; - QString m_mountpoint; - QString m_errdev; - QString m_usberr; - QString m_incompat; QList m_usbconid; }; -- cgit v1.2.3