diff options
author | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2013-09-18 22:06:41 +0200 |
---|---|---|
committer | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2013-09-18 23:37:39 +0200 |
commit | b943c59f3575ee357b66cc316baec95ffcfd5f10 (patch) | |
tree | 5d7356cc1b2d394fee832e8f4cf9f1fc12da09ae /rbutil/rbutilqt/base/autodetection.h | |
parent | fe45f8f090ae64ff5b8bad59ce628662ea60209a (diff) | |
download | rockbox-b943c59f3575ee357b66cc316baec95ffcfd5f10.tar.gz rockbox-b943c59f3575ee357b66cc316baec95ffcfd5f10.zip |
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
Diffstat (limited to 'rbutil/rbutilqt/base/autodetection.h')
-rw-r--r-- | rbutil/rbutilqt/base/autodetection.h | 17 |
1 files changed, 9 insertions, 8 deletions
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 @@ | |||
25 | #include <QObject> | 25 | #include <QObject> |
26 | #include <QString> | 26 | #include <QString> |
27 | #include <QList> | 27 | #include <QList> |
28 | #include <QStringList> | ||
28 | 29 | ||
29 | class Autodetection :public QObject | 30 | class Autodetection :public QObject |
30 | { | 31 | { |
@@ -39,29 +40,29 @@ public: | |||
39 | PlayerMtpMode, | 40 | PlayerMtpMode, |
40 | PlayerWrongFilesystem, | 41 | PlayerWrongFilesystem, |
41 | PlayerError, | 42 | PlayerError, |
43 | PlayerAmbiguous, | ||
42 | }; | 44 | }; |
43 | 45 | ||
44 | struct Detected { | 46 | struct Detected { |
45 | QString device; | 47 | QString device; |
48 | QStringList usbdevices; | ||
46 | QString mountpoint; | 49 | QString mountpoint; |
47 | enum PlayerStatus status; | 50 | enum PlayerStatus status; |
48 | }; | 51 | }; |
49 | 52 | ||
50 | bool detect(); | 53 | bool detect(); |
51 | 54 | ||
52 | QList<struct Detected> detected(void); | 55 | QList<struct Detected> detected(void) { return m_detected; } |
53 | 56 | ||
54 | private: | 57 | private: |
55 | QString resolveMountPoint(QString); | 58 | QString resolveMountPoint(QString); |
56 | bool detectUsb(void); | 59 | void detectUsb(void); |
57 | bool detectAjbrec(QString); | 60 | void mergeMounted(void); |
61 | void mergePatcher(void); | ||
62 | QString detectAjbrec(QString); | ||
63 | int findDetectedDevice(QString device); | ||
58 | 64 | ||
59 | QList<struct Detected> m_detected; | 65 | QList<struct Detected> m_detected; |
60 | QString m_device; | ||
61 | QString m_mountpoint; | ||
62 | QString m_errdev; | ||
63 | QString m_usberr; | ||
64 | QString m_incompat; | ||
65 | QList<int> m_usbconid; | 66 | QList<int> m_usbconid; |
66 | }; | 67 | }; |
67 | 68 | ||