Issues using serial debugging (Mouse moving)

OS: Windows 7 x64
Serial Console Used: the one that comes w/ the Arduino software

What Happens:
As soon as the Core boots up the below code my computer recognizes a "new" device.
Every few seconds my mouse is moved down and to he right about 100 ish pixels
All buttons are now the the "Middle Click" or at least act like it (clicking on a tab in chrome closes it which happens when you middle click"
This can only be fixed by unplugging the core and randomly plugging and unplugging my mouse connected to my computer.
It appears the issue is a result of the SparkCore installing itself as a mouse and serial port "combo" of sorts.

Any idea why this is happening?

byte mac[6]; // the MAC address of your Wifi shield
int LED = D7;

void setup()
{
pinMode(LED, OUTPUT);

Serial.begin(9600);
Network.macAddress(mac);

}

void loop() {

Serial.print("MAC: ");
Serial.print(mac[5],HEX);
Serial.print(":");
Serial.print(mac[4],HEX);
Serial.print(":");
Serial.print(mac[3],HEX);
Serial.print(":");
Serial.print(mac[2],HEX);
Serial.print(":");
Serial.print(mac[1],HEX);
Serial.print(":");
Serial.println(mac[0],HEX);
digitalWrite(LED, HIGH);
delay(5000);
digitalWrite(LED, LOW);
delay(5000);

}

Hi @harrisonhjones,

The Core should definitely not be acting as a mouse! Unless you have some custom driver software with misconfigured vendor / product IDs or some rogue driver or software interfering with hardware on your machine. If you wanted to double check, you could open up your device manager and look under “Mice and other pointing devices.” Or if you could provide text output of how your computer recognizes the core – that would be interesting.

I’m guessing there might be some low-power interaction between your mouse and the core trying to draw sufficient power. Sounds like maybe you could try powering your mouse / core over a powered USB hub. I would also be curious to know what brand mouse / drivers, control mechanism, etc.

Thanks,
David

I ended up never getting this problem again. I frankly don’t know what I did. I used the drives supplied by Spark and the movement happened every 10 seconds so it wasn’t just random; the core was doing it!

This makes me wonder: do y’all have plans to release drivers so the core can behave as a HID compliant mouse/keyboard? It appears the core is able to, even if by accident.

1 Like

That’s so weird! Please let me know if this crops up again, or other people please chime in if you see this.

I’m sure a bunch of community members know more about building HID devices than I do, so this might be a great opportunity for a pull request? :slight_smile: Or is anybody out there working on this already?

I have the same issue. I have used arduino serial out code and spark driver.

Every second the mouse is moved to bottom right hand corner of screen. This is the same timing as my serial out information

@Dave Same exact thing happened to me when I was working setting up my IN219 current sensor.

Soon as the core was plugged into my laptop it took the mouse down to the start button every 3 seconds basically making the computer unusable.

After numerous times of re flashing the sketch to the Core over the Spark IDE the core froze up and would only show the solid blue pin 7 LED light. I had to Factory Reset the core and then reload the sketch and it never happened again.

I had the same problem also! As soon as my program ran on the core, the mouse started doing its own thing. I had to reboot my PC for the mouse to work properly. Only when I did a factory reset did it stop. I have not tried a new sketch yet.

@Dave @zachary @zach I'm not sure which is causing the bug but it's indeed happening

EDIT: Sending hex over serial was causing the issue. The HEX values probably got recognized as HID commands

Serial.print(a[j], HEX);

1 Like

In terms of weird interactions / bugs, that’s pretty wild! :slight_smile: This name “Microsoft Serial Ballpoint” is magic, because searching for that shows a lot of people having this same problem with USB serial devices:

The fix for this appears to be to disable Window’s support for crazy Serial mice entirely

##Warning! This fix involves editing your registry, make a restore point first!

###I have wrecked machines by goofing up a registry edit, you should really make a restore point first.

in regedit:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SerMouse
and change the value “Start” from 3 (load on demand) to 4 (disabled)

more info here:
http://www.curioustech.net/xport.html
http://support.microsoft.com/kb/103000

Thanks!
David

11 Likes

@Dave Tested and working!

Luckily you had a fix real fast or i can’t continue to get the Camera code running! Hoping to get it working to the core ASAP for more users to try it out :slight_smile:

2 Likes

I’m glad we know what was causing this without much trouble. Nice to know we know how prevent this from happening again also. Good work guys!

1 Like

Just thinking if anyone met this issue recently…

I was trying to output the response from the GET request from google and print via Serial.

Didn’t get the terminal opened before the core starts to spill out all the data and my mouse ran all over the place.

My device manager had like 2 to 3 more mouse (ps/2 and usb virtual) appearing

Just encountered this for the first time. The registry hack fixed it for me. Thanks guys!

1 Like

I have been having this problem sending hex over USB serial.

All I did was these lines and my mouse went crazy:

void setup() {
        Serial.begin(9600);  //used with monitor
}

void loop() {
//    Serial.println("408b42A6");  //this line works

    Serial.println("408B42A6");  //this lines blows it up.

    delay(1000);
}

I will try the fix above.

I just did this fix for my windows 8.1 computer and it solved the problem. How weird printing hex makes the computer to go bonkers.

Still can’t believe that this issue still plagues Windows. :smile:

We used to have the exact same issue with Windows 2000 many many years ago with a serial device that used to send data on power up. Windows would randomly detect this as a mouse on startup. It gave us such IT headaches.

2 Likes

Dave, thanks so much for that! That was driving me nuts, and I was having a hell of a time figuring it out!

Best,
Aric

1 Like

Wow, I can’t say how much time I wasted with this bug. It was crazy because the serial monitor worked but instead of my time (reading an external RTC over I2C) I got only shit, and I thought I have wrong variable types. But only after few days I make an fully restart (my notebook usually go to standby) there was suddenly a spark core arduino mouse which jumped funny around and now I find your bug fix. :smiley:
This given me a lot of gray hairs, I promise. :older_man:

greetings from Austria!

1 Like

Ran into the (Photon) serial mouse problem too. So weird. Registry key worked like a charm.

Is there any course for Particle to address this? (Change in the drivers?)

This bug turned into a huge issue with a lab of students, where 20% of students experienced this (on both lab computers and entirely different student computers). It really is a pain to have students making registry changes as part of a lab.

1 Like