Ejemplo n.º 1
0
BOOL vmulti_connect(pvmulti_client vmulti)
{
    //
    // Find the HID devices
    //

    vmulti->hControl = SearchMatchingHwID(0xff00, 0x0001);
    if (vmulti->hControl == INVALID_HANDLE_VALUE || vmulti->hControl == NULL)
        return FALSE;
    vmulti->hMessage = SearchMatchingHwID(0xff00, 0x0002);
    if (vmulti->hMessage == INVALID_HANDLE_VALUE || vmulti->hMessage == NULL)
    {
        vmulti_disconnect(vmulti);
        return FALSE;
    }

    //
    // Set the buffer count to 10 on the message HID
    //

    if (!HidD_SetNumInputBuffers(vmulti->hMessage, 10))
    {
        printf("failed HidD_SetNumInputBuffers %d\n", GetLastError());
        vmulti_disconnect(vmulti);
        return FALSE;
    }

    return TRUE;
}
Ejemplo n.º 2
0
INT __cdecl
main(
    int argc,
    PCHAR argv[]
    )
{
    BYTE   reportId;
    pvmulti_client vmulti;

    UNREFERENCED_PARAMETER(argv);

    //
    // Parse command line
    //

    if (argc == 1)
    {
        Usage();
        return 1;
    }
    if (strcmp(argv[1], "/multitouch") == 0)
    {
        reportId = REPORTID_MTOUCH;
    }
    else if (strcmp(argv[1], "/mouse") == 0)
    {
        reportId = REPORTID_MOUSE;
    }
    else if (strcmp(argv[1], "/digitizer") == 0)
    {
        reportId = REPORTID_DIGI;
    }
    else if (strcmp(argv[1], "/joystick") == 0)
    {
        reportId = REPORTID_JOYSTICK;
    }
    else if (strcmp(argv[1], "/keyboard") == 0)
    {
        reportId = REPORTID_KEYBOARD;
    }
    else if (strcmp(argv[1], "/message") == 0)
    {
        reportId = REPORTID_MESSAGE;
    }
    else
    {
        Usage();
        return 1;
    }

    //
    // File device
    //

    vmulti = vmulti_alloc();

    if (vmulti == NULL)
    {
        return 2;
    }

    if (!vmulti_connect(vmulti))
    {
        vmulti_free(vmulti);
        return 3;
    }

    printf("...sending request(s) to our device\n");
    SendHidRequests(vmulti, reportId);

    vmulti_disconnect(vmulti);

    vmulti_free(vmulti);

    return 0;
}
Ejemplo n.º 3
0
void VMultiRelease( void *client ){
    vmulti_disconnect( client );
    vmulti_free( client );
}