Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
b804411f
Unverified
Commit
b804411f
authored
Jan 22, 2019
by
Don Gagne
Committed by
GitHub
Jan 22, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7183 from DonLakeFlyer/AndroidSerialPermissions
Fix android USB permissions
parents
6580a544
6243dbac
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
271 additions
and
318 deletions
+271
-318
CdcAcmSerialDriver.java
...com/hoho/android/usbserial/driver/CdcAcmSerialDriver.java
+2
-2
CommonUsbSerialDriver.java
.../hoho/android/usbserial/driver/CommonUsbSerialDriver.java
+22
-6
Cp2102SerialDriver.java
...com/hoho/android/usbserial/driver/Cp2102SerialDriver.java
+2
-2
FtdiSerialDriver.java
...c/com/hoho/android/usbserial/driver/FtdiSerialDriver.java
+2
-2
ProlificSerialDriver.java
...m/hoho/android/usbserial/driver/ProlificSerialDriver.java
+2
-2
UsbSerialDriver.java
...rc/com/hoho/android/usbserial/driver/UsbSerialDriver.java
+10
-0
UsbSerialProber.java
...rc/com/hoho/android/usbserial/driver/UsbSerialProber.java
+4
-20
QGCActivity.java
android/src/org/mavlink/qgroundcontrol/QGCActivity.java
+226
-283
qserialport_android.cpp
libs/qtandroidserialport/src/qserialport_android.cpp
+1
-1
No files found.
android/src/com/hoho/android/usbserial/driver/CdcAcmSerialDriver.java
View file @
b804411f
...
...
@@ -41,8 +41,8 @@ public class CdcAcmSerialDriver extends CommonUsbSerialDriver {
private
static
final
int
SET_CONTROL_LINE_STATE
=
0x22
;
private
static
final
int
SEND_BREAK
=
0x23
;
public
CdcAcmSerialDriver
(
UsbDevice
device
,
UsbDeviceConnection
connection
)
{
super
(
device
,
connection
);
public
CdcAcmSerialDriver
(
UsbDevice
device
)
{
super
(
device
);
}
@Override
...
...
android/src/com/hoho/android/usbserial/driver/CommonUsbSerialDriver.java
View file @
b804411f
...
...
@@ -35,11 +35,13 @@ abstract class CommonUsbSerialDriver implements UsbSerialDriver {
public
static
final
int
DEFAULT_READ_BUFFER_SIZE
=
16
*
1024
;
public
static
final
int
DEFAULT_WRITE_BUFFER_SIZE
=
16
*
1024
;
protected
final
UsbDevice
mDevice
;
protected
final
UsbDeviceConnection
mConnection
;
protected
final
UsbDevice
mDevice
;
protected
final
Object
mReadBufferLock
=
new
Object
();
protected
final
Object
mWriteBufferLock
=
new
Object
();
protected
final
Object
mReadBufferLock
=
new
Object
();
protected
final
Object
mWriteBufferLock
=
new
Object
();
protected
UsbDeviceConnection
mConnection
=
null
;
private
int
_permissionStatus
=
permissionStatusRequestRequired
;
/** Internal read buffer. Guarded by {@link #mReadBufferLock}. */
protected
byte
[]
mReadBuffer
;
...
...
@@ -47,14 +49,28 @@ abstract class CommonUsbSerialDriver implements UsbSerialDriver {
/** Internal write buffer. Guarded by {@link #mWriteBufferLock}. */
protected
byte
[]
mWriteBuffer
;
public
CommonUsbSerialDriver
(
UsbDevice
device
,
UsbDeviceConnection
connection
)
{
public
CommonUsbSerialDriver
(
UsbDevice
device
)
{
mDevice
=
device
;
mConnection
=
connection
;
mReadBuffer
=
new
byte
[
DEFAULT_READ_BUFFER_SIZE
];
mWriteBuffer
=
new
byte
[
DEFAULT_WRITE_BUFFER_SIZE
];
}
@Override
public
void
setConnection
(
UsbDeviceConnection
connection
)
{
mConnection
=
connection
;
}
@Override
public
int
permissionStatus
()
{
return
_permissionStatus
;
}
@Override
public
void
setPermissionStatus
(
int
permissionStatus
)
{
_permissionStatus
=
permissionStatus
;
}
/**
* Returns the currently-bound USB device.
*
...
...
android/src/com/hoho/android/usbserial/driver/Cp2102SerialDriver.java
View file @
b804411f
...
...
@@ -61,8 +61,8 @@ public class Cp2102SerialDriver extends CommonUsbSerialDriver {
private
UsbEndpoint
mReadEndpoint
;
private
UsbEndpoint
mWriteEndpoint
;
public
Cp2102SerialDriver
(
UsbDevice
device
,
UsbDeviceConnection
connection
)
{
super
(
device
,
connection
);
public
Cp2102SerialDriver
(
UsbDevice
device
)
{
super
(
device
);
}
private
int
setConfigSingle
(
int
request
,
int
value
)
{
...
...
android/src/com/hoho/android/usbserial/driver/FtdiSerialDriver.java
View file @
b804411f
...
...
@@ -211,8 +211,8 @@ public class FtdiSerialDriver extends CommonUsbSerialDriver {
* @throws UsbSerialRuntimeException if the given device is incompatible
* with this driver
*/
public
FtdiSerialDriver
(
UsbDevice
usbDevice
,
UsbDeviceConnection
usbConnection
)
{
super
(
usbDevice
,
usbConnection
);
public
FtdiSerialDriver
(
UsbDevice
usbDevice
)
{
super
(
usbDevice
);
mType
=
null
;
}
...
...
android/src/com/hoho/android/usbserial/driver/ProlificSerialDriver.java
View file @
b804411f
...
...
@@ -231,8 +231,8 @@ public class ProlificSerialDriver extends CommonUsbSerialDriver {
return
((
getStatus
()
&
flag
)
==
flag
);
}
public
ProlificSerialDriver
(
UsbDevice
device
,
UsbDeviceConnection
connection
)
{
super
(
device
,
connection
);
public
ProlificSerialDriver
(
UsbDevice
device
)
{
super
(
device
);
}
@Override
...
...
android/src/com/hoho/android/usbserial/driver/UsbSerialDriver.java
View file @
b804411f
...
...
@@ -83,6 +83,16 @@ public interface UsbSerialDriver {
/** 2 stop bits. */
public
static
final
int
STOPBITS_2
=
2
;
public
static
final
int
permissionStatusSuccess
=
0
;
public
static
final
int
permissionStatusDenied
=
1
;
public
static
final
int
permissionStatusRequested
=
2
;
public
static
final
int
permissionStatusRequestRequired
=
3
;
public
static
final
int
permissionStatusOpen
=
4
;
public
int
permissionStatus
();
public
void
setPermissionStatus
(
int
permissionStatus
);
public
void
setConnection
(
UsbDeviceConnection
connection
);
/**
* Returns the currently-bound USB device.
*
...
...
android/src/com/hoho/android/usbserial/driver/UsbSerialProber.java
View file @
b804411f
...
...
@@ -65,11 +65,7 @@ public enum UsbSerialProber {
if
(!
testIfSupported
(
usbDevice
,
FtdiSerialDriver
.
getSupportedDevices
()))
{
return
Collections
.
emptyList
();
}
final
UsbDeviceConnection
connection
=
manager
.
openDevice
(
usbDevice
);
if
(
connection
==
null
)
{
return
Collections
.
emptyList
();
}
final
UsbSerialDriver
driver
=
new
FtdiSerialDriver
(
usbDevice
,
connection
);
final
UsbSerialDriver
driver
=
new
FtdiSerialDriver
(
usbDevice
);
return
Collections
.
singletonList
(
driver
);
}
},
...
...
@@ -80,11 +76,7 @@ public enum UsbSerialProber {
if
(!
testIfSupported
(
usbDevice
,
CdcAcmSerialDriver
.
getSupportedDevices
()))
{
return
Collections
.
emptyList
();
}
final
UsbDeviceConnection
connection
=
manager
.
openDevice
(
usbDevice
);
if
(
connection
==
null
)
{
return
Collections
.
emptyList
();
}
final
UsbSerialDriver
driver
=
new
CdcAcmSerialDriver
(
usbDevice
,
connection
);
final
UsbSerialDriver
driver
=
new
CdcAcmSerialDriver
(
usbDevice
);
return
Collections
.
singletonList
(
driver
);
}
},
...
...
@@ -95,11 +87,7 @@ public enum UsbSerialProber {
if
(!
testIfSupported
(
usbDevice
,
Cp2102SerialDriver
.
getSupportedDevices
()))
{
return
Collections
.
emptyList
();
}
final
UsbDeviceConnection
connection
=
manager
.
openDevice
(
usbDevice
);
if
(
connection
==
null
)
{
return
Collections
.
emptyList
();
}
final
UsbSerialDriver
driver
=
new
Cp2102SerialDriver
(
usbDevice
,
connection
);
final
UsbSerialDriver
driver
=
new
Cp2102SerialDriver
(
usbDevice
);
return
Collections
.
singletonList
(
driver
);
}
},
...
...
@@ -110,11 +98,7 @@ public enum UsbSerialProber {
if
(!
testIfSupported
(
usbDevice
,
ProlificSerialDriver
.
getSupportedDevices
()))
{
return
Collections
.
emptyList
();
}
final
UsbDeviceConnection
connection
=
manager
.
openDevice
(
usbDevice
);
if
(
connection
==
null
)
{
return
Collections
.
emptyList
();
}
final
UsbSerialDriver
driver
=
new
ProlificSerialDriver
(
usbDevice
,
connection
);
final
UsbSerialDriver
driver
=
new
ProlificSerialDriver
(
usbDevice
);
return
Collections
.
singletonList
(
driver
);
}
};
...
...
android/src/org/mavlink/qgroundcontrol/QGCActivity.java
View file @
b804411f
This diff is collapsed.
Click to expand it.
libs/qtandroidserialport/src/qserialport_android.cpp
View file @
b804411f
...
...
@@ -197,7 +197,7 @@ bool QSerialPortPrivate::open(QIODevice::OpenMode mode)
if
(
deviceId
==
BAD_PORT
)
{
qWarning
()
<<
"Error opening
%s
"
<<
systemLocation
.
toLatin1
().
data
();
qWarning
()
<<
"Error opening"
<<
systemLocation
.
toLatin1
().
data
();
q_ptr
->
setError
(
QSerialPort
::
DeviceNotFoundError
);
return
false
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment