|
From: Tim R. <ti...@pr...> - 2011-04-14 17:34:23
|
pauldamool wrote:
> I am trying to communicate with an usb device (NI GPIB-USB-B) to get some
> physical measurements...
> I find the device, but the function usb_bulk_write returns the following
> error :
>
> error submitting URB: No such file or directory
>
> I am probably doing something wrong, and I spent lots of time to find my
> mistake... Any help pointing out my error would be appreciated.
Have you double-checked the endpoint numbers and endpoint types?
> //struct usb_dev_handle *usb_handle = NULL;
> int verbose_mode = 0;
If that's commented out, where are you storing the usb_handle?
> /***********************************************/
> // MAIN
> /***********************************************/
>
> int main(void){
>
> int i;
>
> int returnValue = connectGPIB();
>
> if(returnValue < 0){
> fprintf(stderr, "Connexion : failed\n");
> return -1;
> }
> else{printf("Connexion : succeeded\n");}
>
> char dataInit[72] = "/0x09/0x1A/0x00/0x03/0x10/0x00/0x01/0x33";
The first major problem you have is that you need backslashes instead of
forward slashes. You are expecting that to be an 8-byte string, but it
is actually a 40-byte string. In fact, I'm not sure why you would use a
string at all for this:
unsigned char dataInit[8] = { 0x09, 0x1A, 0x00, 0x03, 0x10, 0x00,
0x01, 0x33 };
> for(i=0;i<2;i++){
> returnValue = usb_bulk_write(usb_handle, EP_OUT , dataInit, 8,
> BULK_TIMEOUT);
> }
Why do you do this twice? You don't check the return value in between,
so you're going to lose whatever error was returned from the first call.
--
Tim Roberts, ti...@pr...
Providenza & Boekelheide, Inc.
|