Reading in
i did set some fields wrong in my control message.
According 7.2.2 i should set SET_REPORT in the thrid field of the control message.
In 7.2 SET_REPORT is defined at 0x09
Fourth field is report type in the high byte and report in the low byte.
I need to send report output and in 7.2.1 this value is 02. Report id can be 0, so this value should be 0x0200 i guess.
For index i can use 0 i presume.
The communication between the device and the lcd is 2 bytes in and 2 bytes out, so the size should be 2.
I set 0x21 for the requesttype, saw it in a couple of examples, not sure WHY i should set it to 0x21 and what this value means though. This leaves me with:
res = usb_control_msg (handle, 0x21, 0x09, 0x0200, 0, data, size, TIMEOUT);
data is the actual 2 bytes of data is wish to send to the lcd, size is 2.
data is the actual data i would have send with usb_interrupt_write.
The value for res is 2.
But i didn't see the result i hoped for after sending these two bytes.
Should i perform a inrerrupt write after this one? If so, why do i need to specify data in the control packet?


Date: Mon, 17 Aug 2009 20:03:32 +0000
Subject: Re: [Libusb-devel] altinterface setting mandatory?

Thanks for your answer.
In order to send this usb hid lcd i would have to send it a report of type HID_REPORT_TYPE_OUTPUT.
So i would need to use usb_control_msg to do this correct?
I can see the attibutes now from the device.
UsagePage: 06 00 FF (size 2)
Usage 09 01 (size 1)
Report size 75 08
Report_id can be 0x00.
int size = 2;
char *data = (char *) malloc(size*sizeof(char));
The data, size and timeout that i normally use in usb_interrupt_write i can use in the control_msg i presume?
usb_control_msg(handle, output_report ,0x02, 0x09, 0x00, data, size, TIMEOUT)
However, it fails in my case.
Any suggestions what i filled out wrong?

> Date: Fri, 14 Aug 2009 12:17:35 -0700
> From:
> To:
> Subject: Re: [Libusb-devel] altinterface setting mandatory?
> Reinoud Koornstra wrote:
> >
> > I wonder whether i have to set an alternate setting for my usb hid
> > device. i noticed in the dmesg ouput:
> >
> > the order in which i things now are: usb_open, usb_set_configuration,
> > usb_claim_interface, usb_set_altinterface and then a bulk_write.
> > ...
> > I have these values read from the device:
> >
> > bNumInterfaces: 1
> > bConfigurationValue: 1
> > iConfiguration: 0
> > bInterfaceNumber: 0
> > bAlternateSetting: 0
> >
> > bInterfaceClass: 3
> >
> > Should i still use set_altinterface in my case or shoud i not?
> If your device doesn't have any alternate settings (other than 0), then
> there's no need to call usb_set_altinterface. The set_configuration
> call will select alternate setting 0 automatically. Unless you have
> isochronous pipes, you probably don't have alternate settings. You're
> supposed to use alternate settings with interrupt pipes, too, but it's
> not commonly done with HID devices.
> > When i try to clear the screen on the usb hid lcd screen, i do this
> > currently with a bulk write.
> Does your device really have a bulk pipe? HID devices usually use an
> interrupt pipe.
> > When should i use a control message to the device? also the syntax for
> > using a control message is vague to me, i didn't see an example. the
> > docs say it should be like this:
> >
> > int usb_control_msg(usb_dev_handle *dev, int requesttype, int request,
> > int value, int index, char *bytes, int size, int timeout)
> >
> > i don't understand these values: int requesttype, int request, int
> > value, int index
> > when should i use a control message and when should i use a bulk
> > write, right now i don't use any control message and i wonder if i
> > should use it for the type of things i am sending the usb hid device.
> You have to KNOW this. It's part of the specifications for the device.
> HID input devices almost always use an interrupt pipe for their reports,
> although the spec allows the control pipe to be used. HID output
> devices have the same options. If you do use a control pipe, you need
> to use the proper requesttype and request values; those are defined in
> the USB HID spec.
> --
> Tim Roberts,
> Providenza & Boekelheide, Inc.
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.
> _______________________________________________
> Libusb-devel mailing list

Windows Live: Make it easier for your friends to see what you’re up to on Facebook. Find out more.

Get back to school stuff for them and cashback for you. Try Bing™ now.