lockdown plugins that touch hardware

pull/739/head
Kevin Hester 2021-03-13 13:14:27 +08:00
rodzic 6813a31895
commit c0ac457cad
9 zmienionych plików z 28 dodań i 5 usunięć

Wyświetl plik

@ -4,9 +4,13 @@ You probably don't care about this section - skip to the next one.
## 1.2 cleanup & multichannel support:
* cleanup the external notification and serial plugins
* non ack version of stress test fails sometimes!
* timestamps on oled screen are wrong - don't seem to be updating based on message rx
* luxon bug report - seeing rx acks for nodes that are not on the network
* channel hash suffixes are wrong on android
* tx fault test has a bug #734
* cdcacm bug on nrf52: emittx thinks it emitted but client sees nothing. works again later
* nrf52: segger logs have errors in formatting that should be impossible (because not going through serial, try stalling on segger)
* DONE call RouterPlugin for *all* packets - not just Router packets

Wyświetl plik

@ -10,6 +10,10 @@ static const uint8_t defaultpsk[] = {0xd4, 0xf1, 0xbb, 0x3a, 0x20, 0x29, 0x07, 0
Channels channels;
const char *Channels::adminChannel = "admin";
const char *Channels::gpioChannel = "gpio";
const char *Channels::serialChannel = "serial";
uint8_t xorHash(const uint8_t *p, size_t len)
{
uint8_t code = 0;

Wyświetl plik

@ -29,6 +29,10 @@ class Channels
int16_t hashes[MAX_NUM_CHANNELS];
public:
/// Well known channel names
static const char *adminChannel, *gpioChannel, *serialChannel;
const ChannelSettings &getPrimary() { return getByIndex(getPrimaryIndex()).settings; }
/** Return the Channel for a specified index */

Wyświetl plik

@ -126,5 +126,5 @@ MeshPacket *AdminPlugin::allocReply()
AdminPlugin::AdminPlugin() : ProtobufPlugin("Admin", PortNum_ADMIN_APP, AdminMessage_fields)
{
// restrict to the admin channel for rx
boundChannel = "admin";
boundChannel = Channels::adminChannel;
}

Wyświetl plik

@ -140,6 +140,11 @@ void ExternalNotificationPlugin::setExternalOff()
// --------
ExternalNotificationPluginRadio::ExternalNotificationPluginRadio() : SinglePortPlugin("ExternalNotificationPluginRadio", PortNum_TEXT_MESSAGE_APP) {
// restrict to the admin channel for rx
boundChannel = Channels::gpioChannel;
}
bool ExternalNotificationPluginRadio::handleReceived(const MeshPacket &mp)
{
#ifndef NO_ESP32

Wyświetl plik

@ -32,7 +32,7 @@ class ExternalNotificationPluginRadio : public SinglePortPlugin
{
public:
ExternalNotificationPluginRadio() : SinglePortPlugin("ExternalNotificationPluginRadio", PortNum_TEXT_MESSAGE_APP) {}
ExternalNotificationPluginRadio();
protected:
//virtual MeshPacket *allocReply();

Wyświetl plik

@ -69,7 +69,8 @@ bool RemoteHardwarePlugin::handleReceivedProtobuf(const MeshPacket &req, const H
case HardwareMessage_Type_READ_GPIOS: {
// Print notification to LCD screen
screen->print("Read GPIOs\n");
if(screen)
screen->print("Read GPIOs\n");
uint64_t res = digitalReads(p.gpio_mask);

Wyświetl plik

@ -61,6 +61,12 @@ SerialPlugin::SerialPlugin() : concurrency::OSThread("SerialPlugin") {}
char serialStringChar[Constants_DATA_PAYLOAD_LEN];
SerialPluginRadio::SerialPluginRadio() : SinglePortPlugin("SerialPluginRadio", PortNum_SERIAL_APP)
{
// restrict to the admin channel for rx
boundChannel = Channels::serialChannel;
}
int32_t SerialPlugin::runOnce()
{
#ifndef NO_ESP32

Wyświetl plik

@ -33,8 +33,7 @@ class SerialPluginRadio : public SinglePortPlugin
from the main code.
*/
// SerialPluginRadio() : SinglePortPlugin("SerialPluginRadio", PortNum_TEXT_MESSAGE_APP) {}
SerialPluginRadio() : SinglePortPlugin("SerialPluginRadio", PortNum_SERIAL_APP) {}
SerialPluginRadio();
/**
* Send our payload into the mesh