Detect if mouse is connected?

  • Using Kernel version 1.08, I observe in the serial debug output messages such as

    Code
    1. Attach moutouchHID

    on connecting a USB mouse to the device and

    Code
    1. Detach moutouchHID

    on disconnecting.
    Is there a way to query whether a mouse is connected?
    Or are there system messages that can be received and processed by a running application?

  • Hello,
    i test this sample under WCE6 (even with PicoCOM4). It seem to work without problems (did you recompile it)?


    When i start the program and mouse is attached i see "HID1:", if mouse is not attached i did not see "HID1:".
    When i plug in mouse while the program is active i got the "attached" event, if i remove mouse while program is active i got "detached" event!

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

  • I recompiled the sample for PicoCOM4.
    In both cases (USB mouse connected or not) the output is the same, the "HID1:" device is listed.
    Reason: A USB keyboard is connected at the same time.
    Only if neither USB keyboard nor USB mouse are connected, the failure to detect a "HID1:" device assures that a mouse is not present.


    So I need another way to check for mouse presence. Do you have any idea?


    On the serial debug output I see messages

    Code
    1. Attach moutouchUSB

    on the mouse plugging in and

    Code
    1. Deach moutouchUSB

    on unplugging the mouse regardless of USB keyboard presence.
    What component issues these messages?
    What action (other than the debug output) is followed by the detection of these events?
    Does an environment variable reflect this state change?
    Is a message sent to all running tasks?


    After some research I found out that probably the mouse driver must be modified to enable device detection reliably.
    See http://us.generation-nt.com/an…ence-help-70822232.html#r e.g.
    In this case, I assume, you (F&S) would have to do this, and it would mean a customised kernel at extra charge.
    Am I right?