Alan Ott | 1 Oct 01:22 2011
Picon

Re: libusb_close - hanging

On 09/30/2011 01:19 PM, Tom Morrison wrote:
> I am shutting down libusb and using a specific device handle, I call
> libusb_release with good results, then I try calling libusb_close
> and it hangs - no return (error or otherwise)?
>
> Any idea of where I should start looking?

Hi Tom,

You should probably give the following information:

1. Which operating system (as much info as you have (kernel version, etc))?
2. Which version of libusb?
3. Does the problem occur with the latest libusb that's in git?
4. What type of device, what are you doing with it? In other words, do
you open/read/close, or open/read/write/close, or just open/close; what
kind of transfers, etc?
5. Can you provide a simple-as-possible program which demonstrates the
problem?

I'd start by building libusb from source with debugging enabled and
running your program in a debugger to get a good handle on where the
hang is taking place.

Alan.

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
(Continue reading)

Alan Ott | 1 Oct 01:22 2011
Picon

Re: libusb_close - hanging

On 09/30/2011 01:19 PM, Tom Morrison wrote:
> I am shutting down libusb and using a specific device handle, I call
> libusb_release with good results, then I try calling libusb_close
> and it hangs - no return (error or otherwise)?
>
> Any idea of where I should start looking?

Hi Tom,

You should probably give the following information:

1. Which operating system (as much info as you have (kernel version, etc))?
2. Which version of libusb?
3. Does the problem occur with the latest libusb that's in git?
4. What type of device, what are you doing with it? In other words, do
you open/read/close, or open/read/write/close, or just open/close; what
kind of transfers, etc?
5. Can you provide a simple-as-possible program which demonstrates the
problem?

I'd start by building libusb from source with debugging enabled and
running your program in a debugger to get a good handle on where the
hang is taking place.

Alan.

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
(Continue reading)

Tom Morrison | 1 Oct 01:45 2011
Picon

Re: libusb_close - hanging

ooops, sorry...

1) Linux CentOS (2.6.18.xxx)
2) libusb-1.0.xxx
3) I haven't tried the latest version
4) I am opening / using a custom usb device...
5) I will put together something on Monday...

The problem I really have is that the documentation says that libusb_close
is NON-blocking...and it hangs when calling this - wth?

tom

On Fri, Sep 30, 2011 at 7:22 PM, Alan Ott <alan <at> signal11.us> wrote:
On 09/30/2011 01:19 PM, Tom Morrison wrote:
> I am shutting down libusb and using a specific device handle, I call
> libusb_release with good results, then I try calling libusb_close
> and it hangs - no return (error or otherwise)?
>
> Any idea of where I should start looking?

Hi Tom,

You should probably give the following information:

1. Which operating system (as much info as you have (kernel version, etc))?
2. Which version of libusb?
3. Does the problem occur with the latest libusb that's in git?
4. What type of device, what are you doing with it? In other words, do
you open/read/close, or open/read/write/close, or just open/close; what
kind of transfers, etc?
5. Can you provide a simple-as-possible program which demonstrates the
problem?

I'd start by building libusb from source with debugging enabled and
running your program in a debugger to get a good handle on where the
hang is taking place.

Alan.




--
------------------------------------------------------------------------------------
Riding to raise money for cancer research: www.Donate2PMC.com

#avg_ls_inline_popup{position:absolute;z-index:9999;padding:0px;margin:0px;overflow:hidden;wordWrap:break-word;color:black;font-size:10px;text-align:left;line-height:130%;}#avg_ls_inline_popup div{border-width:3px;border-style:solid;padding:3px;padding-left:8px;padding-right:8px;-moz-border-radius:5px;-webkit-border-radius:5px;}#avg_ls_inline_popup .red{border-color:#D20003;;background-color:#F5D4C1;;}#avg_ls_inline_popup .orange{border-color:#F57301;;background-color:#FFD3B0;;}#avg_ls_inline_popup .yellow{border-color:#EAA500;;background-color:#FEEFAE;;}#avg_ls_inline_popup .green{border-color:#00A120;;background-color:#C3E5CA;;}
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2
_______________________________________________
Libusb-devel mailing list
Libusb-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusb-devel
Vitali Lovich | 1 Oct 01:48 2011
Picon

Re: libusb_close - hanging

I believe there's a bug in the kernel version you're using.  I believe
this was covered previously on the mailing list.

http://libusb.6.n5.nabble.com/libusb-and-or-kernel-cause-complete-hang-td5853.html

On Fri, Sep 30, 2011 at 4:45 PM, Tom Morrison <somnyrds <at> gmail.com> wrote:
> ooops, sorry...
>
> 1) Linux CentOS (2.6.18.xxx)
> 2) libusb-1.0.xxx
> 3) I haven't tried the latest version
> 4) I am opening / using a custom usb device...
> 5) I will put together something on Monday...
>
> The problem I really have is that the documentation says that libusb_close
> is NON-blocking...and it hangs when calling this - wth?
>
> tom
>
> On Fri, Sep 30, 2011 at 7:22 PM, Alan Ott <alan <at> signal11.us> wrote:
>>
>> On 09/30/2011 01:19 PM, Tom Morrison wrote:
>> > I am shutting down libusb and using a specific device handle, I call
>> > libusb_release with good results, then I try calling libusb_close
>> > and it hangs - no return (error or otherwise)?
>> >
>> > Any idea of where I should start looking?
>>
>> Hi Tom,
>>
>> You should probably give the following information:
>>
>> 1. Which operating system (as much info as you have (kernel version,
>> etc))?
>> 2. Which version of libusb?
>> 3. Does the problem occur with the latest libusb that's in git?
>> 4. What type of device, what are you doing with it? In other words, do
>> you open/read/close, or open/read/write/close, or just open/close; what
>> kind of transfers, etc?
>> 5. Can you provide a simple-as-possible program which demonstrates the
>> problem?
>>
>> I'd start by building libusb from source with debugging enabled and
>> running your program in a debugger to get a good handle on where the
>> hang is taking place.
>>
>> Alan.
>>
>
>
>
> --
> ------------------------------------------------------------------------------------
> Riding to raise money for cancer research: www.Donate2PMC.com
>
>
> ------------------------------------------------------------------------------
> All of the data generated in your IT infrastructure is seriously valuable.
> Why? It contains a definitive record of application performance, security
> threats, fraudulent activity, and more. Splunk takes this data and makes
> sense of it. IT sense. And common sense.
> http://p.sf.net/sfu/splunk-d2dcopy2
> _______________________________________________
> Libusb-devel mailing list
> Libusb-devel <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/libusb-devel
>
>

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2
Tom Morrison | 1 Oct 02:52 2011
Picon

Re: libusb_close - hanging

hmmm...if I read the entire thing - I need a new kernel version...something like 2.6.27.xxx....

- I have other tools on this linux box that I am not sure I can upgrade the kernel...

I will investigate this....

t

On Fri, Sep 30, 2011 at 7:48 PM, Vitali Lovich <vlovich <at> gmail.com> wrote:
I believe there's a bug in the kernel version you're using.  I believe
this was covered previously on the mailing list.

http://libusb.6.n5.nabble.com/libusb-and-or-kernel-cause-complete-hang-td5853.html

On Fri, Sep 30, 2011 at 4:45 PM, Tom Morrison <somnyrds <at> gmail.com> wrote:
> ooops, sorry...
>
> 1) Linux CentOS (2.6.18.xxx)
> 2) libusb-1.0.xxx
> 3) I haven't tried the latest version
> 4) I am opening / using a custom usb device...
> 5) I will put together something on Monday...
>
> The problem I really have is that the documentation says that libusb_close
> is NON-blocking...and it hangs when calling this - wth?
>
> tom
>
> On Fri, Sep 30, 2011 at 7:22 PM, Alan Ott <alan <at> signal11.us> wrote:
>>
>> On 09/30/2011 01:19 PM, Tom Morrison wrote:
>> > I am shutting down libusb and using a specific device handle, I call
>> > libusb_release with good results, then I try calling libusb_close
>> > and it hangs - no return (error or otherwise)?
>> >
>> > Any idea of where I should start looking?
>>
>> Hi Tom,
>>
>> You should probably give the following information:
>>
>> 1. Which operating system (as much info as you have (kernel version,
>> etc))?
>> 2. Which version of libusb?
>> 3. Does the problem occur with the latest libusb that's in git?
>> 4. What type of device, what are you doing with it? In other words, do
>> you open/read/close, or open/read/write/close, or just open/close; what
>> kind of transfers, etc?
>> 5. Can you provide a simple-as-possible program which demonstrates the
>> problem?
>>
>> I'd start by building libusb from source with debugging enabled and
>> running your program in a debugger to get a good handle on where the
>> hang is taking place.
>>
>> Alan.
>>
>
>
>
> --
> ------------------------------------------------------------------------------------
> Riding to raise money for cancer research: www.Donate2PMC.com
>
>
> ------------------------------------------------------------------------------
> All of the data generated in your IT infrastructure is seriously valuable.
> Why? It contains a definitive record of application performance, security
> threats, fraudulent activity, and more. Splunk takes this data and makes
> sense of it. IT sense. And common sense.
> http://p.sf.net/sfu/splunk-d2dcopy2
> _______________________________________________
> Libusb-devel mailing list
> Libusb-devel <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/libusb-devel
>
>



--
------------------------------------------------------------------------------------
Riding to raise money for cancer research: www.Donate2PMC.com

#avg_ls_inline_popup{position:absolute;z-index:9999;padding:0px;margin:0px;overflow:hidden;wordWrap:break-word;color:black;font-size:10px;text-align:left;line-height:130%;}#avg_ls_inline_popup div{border-width:3px;border-style:solid;padding:3px;padding-left:8px;padding-right:8px;-moz-border-radius:5px;-webkit-border-radius:5px;}#avg_ls_inline_popup .red{border-color:#D20003;;background-color:#F5D4C1;;}#avg_ls_inline_popup .orange{border-color:#F57301;;background-color:#FFD3B0;;}#avg_ls_inline_popup .yellow{border-color:#EAA500;;background-color:#FEEFAE;;}#avg_ls_inline_popup .green{border-color:#00A120;;background-color:#C3E5CA;;}
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2
_______________________________________________
Libusb-devel mailing list
Libusb-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusb-devel
Xiaofan Chen | 1 Oct 03:03 2011
Picon

Re: libusb_close - hanging

On Sat, Oct 1, 2011 at 8:52 AM, Tom Morrison <somnyrds <at> gmail.com> wrote:
> hmmm...if I read the entire thing - I need a new kernel version...something
> like 2.6.27.xxx....
>
> - I have other tools on this linux box that I am not sure I can upgrade the
> kernel...
>
> I will investigate this....
>

That thread may or may not be related to your issue. You may try 1.0.9-rc3
first to see if problem goes away with this latest version of libusb-1.0.
http://git.libusb.org/?p=libusb-stuge.git;a=summary;js=1

--

-- 
Xiaofan

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2
Xiaofan Chen | 1 Oct 04:34 2011
Picon

Re: Problem with libusb_bulk_transfer while reading

On Sat, Oct 1, 2011 at 4:15 AM, vijaykri <vijay.15.k <at> gmail.com> wrote:
> Hi All,
>
> We have developed a USB device and we are trying to communicate with the
> host using libusb.
>
> With the endpoint 0x01, I am able to write to device but I could not read
> back from endpoint 0x81.
>
> I tried writing and reading --> writing performed and read not happended
>
> also
>
> I tried only reading, reading failed with return -99.
>
> The debug message shows as:
> libusb:Warning [do_sync_bulk_transfer] unrecognised status code 1; with
> return value -99.
>
> Can anyone let me know if you have encountered a same problem

More information is needed.

1. Since you developed the device, so you do have access to the firmware
and know the communication protocol, right? Are you sure your codes
correspond to the communication protocol?
2. What is the OS and what is the libusb version?
3. Code snippets

--

-- 
Xiaofan

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2
Xiaofan Chen | 1 Oct 04:37 2011
Picon

Re: usb_claim_interface returns -1

On Wed, Sep 28, 2011 at 5:26 PM, t.elimpus
<anthony.moore.bd <at> btinternet.com> wrote:
> I'm programming for an android tablet. The method looks like this:
>
> JNIEXPORT jint JNICALL Java_com_lib_Lib_claim_1int
>  (JNIEnv * env, jobject obj, jstring Usb_Dir){
>        int claim_int_res;
>
>        const jbyte *str;
>        str = (*env)->GetStringUTFChars(env, Usb_Dir, NULL);
>
>        char cmd[100] = "su -c \"chmod 777 /proc/bus/usb/001/";
>        strcat(cmd, str);
>        strcat(cmd, "\"");

What is this? Does Android not have udev or things like that?
Are you sure your device is at that place?

>        system(cmd);
>
>        claim_int_res = usb_claim_interface(device_handle,interface);
>
>        if (0 <= claim_int_res)
>        {
>                //printf("interface (i=%d) claimed\n",interface);
>                claimed=1;
>                return 1;
>        }
>        else
>        {
>                //printf("usb_wrap.c: Error: could not claim interface (i=%d),return
> value = %d, %s\n",interface,claim_int_res,strerror(errno));
>                //do_exit(-1);
>                return claim_int_res;
>        }
> }
>

Maybe the device is claimed by other drivers. So you may want
to check if that is true or not. If yes, then you have to detach the
kernel driver.

--

-- 
Xiaofan

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2
Xiaofan Chen | 1 Oct 04:40 2011
Picon

Re: /dev/usbdev1.1 vs. /dev/bus/usb/001

On Tue, Sep 27, 2011 at 9:56 PM,  <hobnob <at> ml1.net> wrote:
> Hah! Hadn't seen the below patch yet. Seems like 2 souls were working on
> the same thing at the same time. Will look into it. However it doesn't
> solve the whole problem yet as permissions are usually wrong (= only
> root writable) on those /dev/usbdevX.X devices. Without udev you can't
> add the usual udev rule that adds write permissions for ordinary users
> based on the VID/PID. Do you or jhanko have a solution there?
>

Manually change the device node permissions?
Or change the way (the codes) these nodes are created and
set the proper permission if you have control of the system?

--

-- 
Xiaofan

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2
vijaykri | 2 Oct 00:51 2011
Picon

Re: Problem with libusb_bulk_transfer while reading

Hi  Xiaofan, 

I have a device on FPGA and we have developed based on the USB protocol. 
We do have many simulation results but now we wanted to try integrating with
the host.

This is the first time I am using libusb libraries, I might be wrong in the
flow. can you let me know the series of steps to be carried out for read;

Below is the code snippet for the read i am doing, I am running on centOS
does it have problems with the linux distro we are using

         #include <iostream>
	#include <stdio.h>
	#include &lt;/libusb-1.0.8/libusb/libusb.h&gt;
	 
	using namespace std;
	 
	int main() {
	    libusb_device **devs; 
	    libusb_device_handle *dev_handle; 
	    libusb_context *ctx = NULL; 
	    libusb_config_descriptor *config;
	   
		
	    uint8_t config_index;

	    int r; //for return values
	    ssize_t cnt; //holding number of devices in list
	    r = libusb_init(&ctx); 
	    if(r < 0) {
	        cout<<"Init Error "<&lt;r&lt;&lt;endl; //there was an error
	        return 1;
	    }
	    libusb_set_debug(ctx, 3); 
	 
	    cnt = libusb_get_device_list(ctx, &amp;devs); 

	    cout&lt;&lt;&quot;No. of devices = &quot;&lt;&lt;cnt&lt;&lt;endl;

	    if(cnt &lt; 0) {
	        cout&lt;&lt;&quot;Get Device Error&quot;&lt;&lt;endl; //there was
an error
	        return 1;
	    }
	    cout&lt;&lt;cnt&lt;&lt;&quot; Devices in list.&quot;&lt;&lt;endl;
	 
	    dev_handle = libusb_open_device_with_vid_pid(ctx,  65278 , 273 );
//these are vendorID and productID I found for my usb device
	    if(dev_handle == NULL)
	        cout&lt;&lt;&quot;Cannot open device&quot;&lt;&lt;endl;
	    else
	        cout&lt;&lt;&quot;Device Opened&quot;&lt;&lt;endl;
	    libusb_free_device_list(devs, 1); //free the list, unref the devices in
it

	
	 
	    int actual; //used to find out how many bytes were written

	    if(libusb_kernel_driver_active(dev_handle, 1) == 1) { //find out if
kernel driver is attached
	        cout&lt;&lt;&quot;Kernel Driver Active&quot;&lt;&lt;endl;
	        if(libusb_detach_kernel_driver(dev_handle, 0) == 0) //detach it
	            cout&lt;&lt;&quot;Kernel Driver Detached!&quot;&lt;&lt;endl;
	    }
	    r = libusb_claim_interface(dev_handle, 1); //claim interface 1 (the
first) of device (mine had jsut 1)
	    if(r &lt; 0) {
	        cout&lt;&lt;&quot;Cannot Claim Interface with return value =
&quot;&lt;&lt; r &lt;&lt;endl;
	        return 1;
	    }

	&lt;b&gt;//Reading the data from USB
	 
 	    r = libusb_bulk_transfer(dev_handle, 81 , data, 3, &actual, 0); //port
81 is the input port
	    if(r == 0 && actual == 1)
	        {cout<<"read Successful!"<&lt;endl;
		 cout&lt;&lt;&quot;Data-REceived
-&gt;"<&lt;data&lt;&lt;&quot;&lt;-&quot;&lt;&lt;endl; 
		 }
	    else
	        cout&lt;&lt;&quot;read Error with r =
&quot;&lt;&lt;r&lt;&lt;endl;&lt;/b&gt;
		

	    r = libusb_release_interface(dev_handle, 1); //release the claimed
interface
	    if(r!=0) {
	        cout<<"Cannot Release Interface"<<endl;
	        return 1;
	    }
	    cout<<"Released Interface"<<endl;
	 

	    libusb_close(dev_handle); //close the device we opened
	    libusb_exit(ctx); //needs to be called to end the
	 
	    delete[] data; //delete the allocated memory for data
	    return 0;
	}

--
View this message in context: http://libusb.6.n5.nabble.com/Problem-with-libusb-bulk-transfer-while-reading-tp4858267p4860887.html
Sent from the LibUSB Dev mailing list archive at Nabble.com.

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2

Gmane