node-dash-button icon indicating copy to clipboard operation
node-dash-button copied to clipboard

Spurious and delayed events with multiple buttons

Open avparker opened this issue 8 years ago • 1 comments

I have registered for the event for 3 buttons by passing an array of mac addresses (code below). I often see one or more of the following (often in combination)

  • an extra spurious event for the previous button
  • an event not firing until the next button is pressed
  • latency of 1 or more minutes (I've seen up to 5 minutes delay)

Example scenario from my real testing

  • Press Button 1 => I see the event for Button 1
  • Wait 1 minute
  • Press Button 2 => I see another event for Button 1 (but no event for Button 2)
  • Wait 1 minute
  • Press Button 3, I see an event to Button 2 (but no event for Button 3)
  • Wait 2 minutes
  • I see an event for Button 3

Another scenario from my real testing

  • Press Button 1 => I see the event for Button 1
  • Wait 1 minute
  • Press Button 2 => I see another event for Button 1 and an event for Button 2
  • Wait 1 minute
  • Press Button 3 => I see another event to Button 2 and and event for Button 3
  • Wait 1 minute
  • Press Button 1 => I do not see any event for Button 1
  • Wait 1 minute
  • Event for Button 1 appears (delayed by 1 minute)
  • Wait 1 minute
  • Press Button 2 => I see an event for Button 2 within 5 seconds
  • Wait 2 minutes
  • I see another event for Button 2 out of the blue

Any idea what's going on? I am running inside an ubuntu 16.04 (xenial) chroot on an Asus Chromebook C302, with node version 8.3.0.

var b_wilkinson = 'b4:7c:9c:92:26:5b';
var b_attack = '34:d2:70:9d:60:31';
var b_genki = 'b4:7c:9c:31:e0:9d';

var dash = dash_button([b_wilkinson, b_attack, b_genki], 'wlan0', '3000', 'udp');

dash.on("detected", function (dash_id){
  if (dash_id === b_wilkinson) {
    console.log("*** WILKINSON ***");
  } else if (dash_id === b_attack) {
    console.log("*** ATTACK ***");
  } else if (dash_id === b_genki) {
    console.log("*** GENKI ***");
  }
  console.log("  detected at " + new Date().toLocaleString());
});`

avparker avatar Aug 12 '17 13:08 avparker

I have reproduced the same behaviour with another version of the same script running on a ODROID C2 (ARM based, similar to a Raspberry Pi), running Ubuntu 16.04, Node version 8.2.1.

If I run the script on the two machines at the same time, the events are usually but not always printed at the same time. i.e. One machine will detect the button, but the other won't.

Furthermore, I hacked the bin/findbutton script, and ran it at the same time as the above app using node-dash-button (on the chromebook). Occasionally either the findbutton script or the app will print the event but the other won't print it until some other button is pressed (the app removes duplicates thanks to the code in node-dash-button, which the findbutton script doesn't).

I have also tried detecting only a single button (i.e. not passing an array), and also see similar behaviour.

I can only guess that the pcap "events" are getting "stuck" in a queue of some sort.

avparker avatar Aug 13 '17 05:08 avparker