[libhid-discuss] libhid::error sending control message: Protocol error !!

Mohamed Ait Ouaziz wa3ziz at gmail.com
Fri Feb 25 21:33:17 UTC 2011


Peter,

here is the simple code im trying to execute:


#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdbool.h>    // To define Have Bool!!
#include<hid.h>


//#define VENDOR_ID_PICARD     0x0461
//#define PRODUCT_ID_FILTER     0x0050
#define INPUTREPORT_SIZE    500

#define ITEM_INPUT 0x81
#define ITEM_OUTPUT 0x01

#define dev_id { 0x0461, 0x0050 ,  NULL, NULL, 0 }

int main(int argc, char *argv[])
{
    printf("Hello World!\n");

    HIDInterface* hid;
    hid_return ret;
    unsigned short vendor_id = 0x0461;
    unsigned short product_id = 0x0050;

    HIDInterfaceMatcher matcher = { vendor_id, product_id ,  NULL, NULL, 0
};

    hid_set_debug(HID_DEBUG_ALL);
    hid_set_debug_stream(stderr);

    ret = hid_init();

    if (ret != HID_RET_SUCCESS)
    {
        fprintf(stderr, "hid_init failed with return code %d\n", ret);
        return 1;
    }

    hid = hid_new_HIDInterface();
    if(hid == 0)
    {
        fprintf(stderr, "hid_new_HIDInterface! Out of memory?\n");
    }


    ret = hid_force_open(hid, 0, &matcher, 3);
    if (ret != HID_RET_SUCCESS)
    {
        fprintf(stderr, "hid_force_open failed with return code %d\n", ret);
        return 1;
    }


    ret = hid_write_identification(stdout, hid);
    if (ret != HID_RET_SUCCESS)
    {
        fprintf(stderr, "hid_write_identification failed with return code
%d\n", ret);
        return 1;
    }

    ret = hid_dump_tree(stdout, hid);
    if (ret != HID_RET_SUCCESS)
    {
        fprintf(stderr, "hid_dump_tree failed with return code %d\n", ret);
        return 1;
    }



    return 0;
}


Do you have any idea about the origin of the error?


cheers,
Mohamed.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/libhid-discuss/attachments/20110225/f301e43a/attachment.htm>


More information about the libhid-discuss mailing list