Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
6184126f
Commit
6184126f
authored
Nov 14, 2015
by
Don Gagne
Browse files
Add requiresUSBMavlinkStart support
parent
be4e5dc3
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/comm/LinkInterface.h
View file @
6184126f
...
...
@@ -125,6 +125,9 @@ public:
/// set into the link when it is added to LinkManager
uint8_t
getMavlinkChannel
(
void
)
const
{
Q_ASSERT
(
_mavlinkChannelSet
);
return
_mavlinkChannel
;
}
/// @return true: "sh /etc/init.d/rc.usb" must be sent on link to start mavlink
virtual
bool
requiresUSBMavlinkStart
(
void
)
const
{
return
false
;
}
// These are left unimplemented in order to cause linker errors which indicate incorrect usage of
// connect/disconnect on link directly. All connect/disconnect calls should be made through LinkManager.
bool
connect
(
void
);
...
...
src/comm/MAVLinkProtocol.cc
View file @
6184126f
...
...
@@ -200,14 +200,16 @@ void MAVLinkProtocol::_linkStatusChanged(LinkInterface* link, bool connected)
// Use the same shared pointer as LinkManager
_connectedLinks
.
append
(
_linkMgr
->
sharedPointerForLink
(
link
));
// Send command to start MAVLink
// XXX hacky but safe
// Start NSH
const
char
init
[]
=
{
0x0d
,
0x0d
,
0x0d
,
0x0d
};
link
->
writeBytes
(
init
,
sizeof
(
init
));
const
char
*
cmd
=
"sh /etc/init.d/rc.usb
\n
"
;
link
->
writeBytes
(
cmd
,
strlen
(
cmd
));
link
->
writeBytes
(
init
,
4
);
if
(
link
->
requiresUSBMavlinkStart
())
{
// Send command to start MAVLink
// XXX hacky but safe
// Start NSH
const
char
init
[]
=
{
0x0d
,
0x0d
,
0x0d
,
0x0d
};
link
->
writeBytes
(
init
,
sizeof
(
init
));
const
char
*
cmd
=
"sh /etc/init.d/rc.usb
\n
"
;
link
->
writeBytes
(
cmd
,
strlen
(
cmd
));
link
->
writeBytes
(
init
,
4
);
}
}
else
{
bool
found
=
false
;
for
(
int
i
=
0
;
i
<
_connectedLinks
.
count
();
i
++
)
{
...
...
src/comm/SerialLink.cc
View file @
6184126f
...
...
@@ -15,10 +15,8 @@
#ifdef __android__
#include
"qserialport.h"
#include
"qserialportinfo.h"
#else
#include
<QSerialPort>
#include
<QSerialPortInfo>
#endif
#include
"SerialLink.h"
...
...
@@ -26,6 +24,7 @@
#include
"MG.h"
#include
"QGCLoggingCategory.h"
#include
"QGCApplication.h"
#include
"QGCSerialPortInfo.h"
QGC_LOGGING_CATEGORY
(
SerialLinkLog
,
"SerialLinkLog"
)
...
...
@@ -380,6 +379,15 @@ LinkConfiguration* SerialLink::getLinkConfiguration()
return
_config
;
}
bool
SerialLink
::
requiresUSBMavlinkStart
(
void
)
const
{
if
(
_port
)
{
return
QGCSerialPortInfo
(
*
_port
).
boardTypePixhawk
();
}
else
{
return
false
;
}
}
//--------------------------------------------------------------------------
//-- SerialConfiguration
...
...
src/comm/SerialLink.h
View file @
6184126f
...
...
@@ -119,7 +119,8 @@ public:
void
requestReset
();
bool
isConnected
()
const
;
qint64
getConnectionSpeed
()
const
;
bool
requiresUSBMavlinkStart
(
void
)
const
;
// These are left unimplemented in order to cause linker errors which indicate incorrect usage of
// connect/disconnect on link directly. All connect/disconnect calls should be made through LinkManager.
bool
connect
(
void
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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