Arduino Leonardo and Ubuntu

Basically something weird is happening with USB keyboard communication and leonardo...

I have a Sketch that wirelessly sends data from an uno with an attached SNES controller to a Leonardo that converts it into keyboard presses... the wireless module is a pair of NRF24L01+

in windows everything works as expected(on same machine as ubuntu install so its not the usb ports)

in linux(i tried both ubuntu and openelec) I can send key-presses for about .5second after power on and it then it stops, the Leonardo does not freeze as I can have a blinking led running concurrently but it will not receive data from wireless link.. its as if after .5sec the wireless communication is interrupted and then I have to re-establish connection by resetting the transmitter(not leonardo)... just to be clear if I press multiple buttons very quickly it works right up until .5sec mark then I have to re-establish connection.

if I power the leonardo from an external power supply(not computer usb) everything works as expected(obviously no keyboard presses are happening but the link stays connected(confirmed with LED)) and as I said on my windows machine without changing a thing I have had the link working for hours

if I use a library with more error checking that auto re-establishes the link it works as expected except it has a .5sec delay while it constantly re-establishes connection.

further testing shows that its specifically when the keyboard initializes that's the issue... as if i modify the sketch to only light an led on button presses it continues to work.. but when sending keyboard presses after a short time it fails... keep in mind that the leonardo does not hang it just stops receiving wireless data.. and can still send keyboard presses via a on board button... once again this works perfect in windows... here is my sketch on the Leonardo(first the pertinent code then the whole code)

void snes_read() {
  SNESbuttons[0] = button_data & 64;        // Left
  SNESbuttons[1] = button_data & 128;       // Right
  SNESbuttons[2] = button_data & 16;        // Up
  SNESbuttons[3] = button_data & 32;        // Down
  SNESbuttons[4] = button_data & 1;         // B
  SNESbuttons[5] = button_data & 2;         // Y
  SNESbuttons[6] = button_data & 4;         // Select
  SNESbuttons[7] = button_data & 8;         // Start
  SNESbuttons[8] = button_data & 256;       // A
  SNESbuttons[9] = button_data & 512;       // X
  SNESbuttons[10] = button_data & 1024;     // L
  SNESbuttons[11] = button_data & 2048;     // R
  int i = 12;
  if (button_data) digitalWrite(ledPin, HIGH);
  else digitalWrite(ledPin, LOW);
  while(i--) {
    if (SNESbuttons[i]) {
      Keyboard.press(letterOutput[i]);
    }
    else {
      Keyboard.release(letterOutput[i]);
    }
  }
}
#include <SPI.h>;
#include <Mirf.h>;
#include <nRF24L01.h>;
#include <MirfHardwareSpiDriver.h>;

// constants won't change. Used here to 
// set pin numbers:
const int ledPin =  2;      // the number of the LED pin

long SerialDelay = 15000;
int data[16];  // here is int format
int button_data;
int SNESbuttons[12];
bool debug = 0; // set to 1(one) if you want info on the serial port

const char letterOutput[12] = {
  216,    // Left
  215,    // Right
  218,    // Up
  217,    // Down
  'z',    // B
  'a',    // Y
  133,    // Select - RShift
  176,    // Start - Enter
  'x',    // A
  's',    // X
  'q',    // L
  'w',    // R
};

void setup(){
  pinMode(ledPin, OUTPUT);
  if (debug)
    Serial.begin(9600);
  Mirf.cePin = 9;
  Mirf.csnPin = 10;
  Mirf.spi = &MirfHardwareSpi;
  Mirf.init();
  Mirf.setRADDR((byte *)"serv1"); //TADDR should change into RADDR if it is a receive
  Mirf.payload = 16;
  Mirf.config();
  if (debug)
    while (!Serial) { // wait for serial port to open or 15seconds
      unsigned long currentMillis = millis();
      if (currentMillis >= SerialDelay) break;
    }
  if (debug);
    Serial.println("Beginning ... ");     // or "Listening ..." on sever
}
void loop(){
  
  if(!Mirf.isSending() && Mirf.dataReady()){
  if (debug)
    Serial.println("Got packet");
  Mirf.getData((byte *) &data);
  button_data = data[0];
  snes_read();
  if (debug)
    Serial.println(button_data);
  }
}

void snes_read() {
  SNESbuttons[0] = button_data & 64;        // Left
  SNESbuttons[1] = button_data & 128;       // Right
  SNESbuttons[2] = button_data & 16;        // Up
  SNESbuttons[3] = button_data & 32;        // Down
  SNESbuttons[4] = button_data & 1;         // B
  SNESbuttons[5] = button_data & 2;         // Y
  SNESbuttons[6] = button_data & 4;         // Select
  SNESbuttons[7] = button_data & 8;         // Start
  SNESbuttons[8] = button_data & 256;       // A
  SNESbuttons[9] = button_data & 512;       // X
  SNESbuttons[10] = button_data & 1024;     // L
  SNESbuttons[11] = button_data & 2048;     // R
  int i = 12;
  if (button_data) digitalWrite(ledPin, HIGH);
  else digitalWrite(ledPin, LOW);
  while(i--) {
    if (SNESbuttons[i]) {
      Keyboard.press(letterOutput[i]);
    }
    else {
      Keyboard.release(letterOutput[i]);
    }
  }
}

well iv been fighting with this for a few days now... and I thought "well what if i put a short delay between key presses" because maybe the buffer is being over run.. it wasnt... in fact this made it a lot worse... so then I figured it out.. the solution was to only update the KB buffer on a change instead of every cycle... weird it worked fine in windows before even weirder it only affected the KB commands in the wireless function as they worked outside of it...

also on a side note.. why can I send KB presses without a previous Keyboard.Beging()?