Problems using libusb after installing AVR32 Studio 2.2

View: New views
7 Messages — Rating Filter:   Alert me  

Problems using libusb after installing AVR32 Studio 2.2

by Frank Tkalcevic :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

(I have posted this on the AVR Freaks forum, so apologies if this upsets
anyone)

After installing AVR32 Studio 2.2 (2.1?) libusb stopped working for other
applications. (This is on Windows XP)

The symptoms were no devices being listed through the libusb listing
functions. (usb_find_busses/devices)

To fix this, I reinstalled libusb-win32 0.1.12.2.

This helped to get libusb listing the usb devices, but there is still another
problem.

My application talks to my AT90USB1287 device, and can tell it to go into boot-
loader mode. The problem is, when I do this, libusb is listing 2 identical
AT90USB1287 DFU devices which confuses my application. There is definitely
only one device connected. usbview.exe (from www.usb.org) lists only one
AT90USB1287 DFU device plugged in.

I've uninstalled AVR32 Studio, the gnu tool chain, libusb and something called
AVR USB, then reinstalled libusb-win32, but the problem remains.

This is definitely a configuration problem. The same software compiled for
Linux works fine.

Any ideas? Does this sound like a libusb problem? Or is there another device
driver on my system reporting a duplicate device?

Thanks,
Frank


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Libusb-win32-devel mailing list
Libusb-win32-devel@...
https://lists.sourceforge.net/lists/listinfo/libusb-win32-devel

Re: Problems using libusb after installing AVR32 Studio 2.2

by Xiaofan Chen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, Oct 16, 2009 at 6:56 AM, Frank Tkalcevic
<frank@...> wrote:

> (I have posted this on the AVR Freaks forum, so apologies if this upsets
> anyone)
>
> After installing AVR32 Studio 2.2 (2.1?) libusb stopped working for other
> applications. (This is on Windows XP)
>
> The symptoms were no devices being listed through the libusb listing
> functions. (usb_find_busses/devices)
>
> To fix this, I reinstalled libusb-win32 0.1.12.2.
>
> This helped to get libusb listing the usb devices, but there is still another
> problem.
>
> Any ideas? Does this sound like a libusb problem? Or is there another device
> driver on my system reporting a duplicate device?
>

Just a guess here. Does avr32 studio install a version of libusb-win32?
Are you using the libusb-win32 filter driver or the device driver? If
you are using the filter driver, uninstall it and then use device driver.
Then give it a try.

By the way, even if libusb-win32 listed two DFU device, your
application should not be confused. Why does that happen?
What testlibusb-win.exe says before and after you have this
problem? If you can, get another PC to see whether you
still have this problem (without install avr32 studio).




--
Xiaofan http://mcuee.blogspot.com

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Libusb-win32-devel mailing list
Libusb-win32-devel@...
https://lists.sourceforge.net/lists/listinfo/libusb-win32-devel

Re: Problems using libusb after installing AVR32 Studio 2.2

by Frank Tkalcevic :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> Just a guess here. Does avr32 studio install a version of libusb-win32?

I think so, but not sure which, or where it is put.  When I reinstalled libusb-
win32-0.1.12.2 it partly started working again.

> Are you using the libusb-win32 filter driver or the device driver? If
> you are using the filter driver, uninstall it and then use device driver.
> Then give it a try.

What is the difference?  I installed libusb-win32-filter-bin-0.1.12.2.exe.  My
device is a plain HID device.  My application works with any HID device.  Is
the device driver install suitable?  I just need the libusb interface in my
application to access the USB devices.

>
> By the way, even if libusb-win32 listed two DFU device, your
> application should not be confused. Why does that happen?

It's confused because it doesn't know which device to program.  It started
with 1 HID device, 0 DFU devices.  Then the HID device was told to become a
DFU device, and suddenly there is 0 HID devices and 2 DFU devices.  It claims
to the user there is more than 1 device.

> What testlibusb-win.exe says before and after you have this
> problem? If you can, get another PC to see whether you
> still have this problem (without install avr32 studio).

testlibusb-win.exe shows 2 devices.  The application works fine on a clean PC.

When I plug my device in, testlibusb shows my HID device...

bus-0/\\.\libusb0-0003--0x1c40-0x04d9     1C40/04D9
- Manufacturer : FranksWorkshop
- Product      : Lathe Pendant
- Serial Number: 00001
  wTotalLength:         41
  bNumInterfaces:       1
  bConfigurationValue:  1
  iConfiguration:       0
  bmAttributes:         80h
  MaxPower:             137
    bInterfaceNumber:   0
    bAlternateSetting:  0
    bNumEndpoints:      2
    bInterfaceClass:    3
    bInterfaceSubClass: 0
    bInterfaceProtocol: 0
    iInterface:         0
      bEndpointAddress: 81h
      bmAttributes:     03h
      wMaxPacketSize:   64
      bInterval:        50
      bRefresh:         0
      bSynchAddress:    0
      bEndpointAddress: 02h
      bmAttributes:     03h
      wMaxPacketSize:   64
      bInterval:        50
      bRefresh:         0
      bSynchAddress:    0



When I make it switch to DFU mode, I get the DFU devce with a similar
bus/devce position (bus-0/\\.\libusb0-0003) and a new one at 13 (bus-0/
\\.\libusb0-0013) ...


bus-0/\\.\libusb0-0003--0x03eb-0x2ffb     03EB/2FFB
- Manufacturer : ATMEL
- Product      : AT90USB128 DFU
- Serial Number: 1.0.0
  wTotalLength:         18
  bNumInterfaces:       1
  bConfigurationValue:  1
  iConfiguration:       0
  bmAttributes:         80h
  MaxPower:             50
    bInterfaceNumber:   0
    bAlternateSetting:  0
    bNumEndpoints:      0
    bInterfaceClass:    0
    bInterfaceSubClass: 0
    bInterfaceProtocol: 0
    iInterface:         0

bus-0/\\.\libusb0-0013--0x03eb-0x2ffb     03EB/2FFB
- Manufacturer : ATMEL
- Product      : AT90USB128 DFU
- Serial Number: 1.0.0
  wTotalLength:         18
  bNumInterfaces:       1
  bConfigurationValue:  1
  iConfiguration:       0
  bmAttributes:         80h
  MaxPower:             50
    bInterfaceNumber:   0
    bAlternateSetting:  0
    bNumEndpoints:      0
    bInterfaceClass:    0
    bInterfaceSubClass: 0
    bInterfaceProtocol: 0
    iInterface:         0







------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Libusb-win32-devel mailing list
Libusb-win32-devel@...
https://lists.sourceforge.net/lists/listinfo/libusb-win32-devel

Re: Problems using libusb after installing AVR32 Studio 2.2

by Xiaofan Chen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, Oct 16, 2009 at 11:21 AM, Frank Tkalcevic
<frank@...> wrote:
>> Are you using the libusb-win32 filter driver or the device driver? If
>> you are using the filter driver, uninstall it and then use device driver.
>> Then give it a try.
>
> What is the difference?  I installed libusb-win32-filter-bin-0.1.12.2.exe.  My
> device is a plain HID device.  My application works with any HID device.  Is
> the device driver install suitable?  I just need the libusb interface in my
> application to access the USB devices.

The filter driver is known to cause problems. Do you have other
application which access your device using the native HID API?
If yes, you can not use the libusb-win32 driver. If no, you can
use the libusb-win32 driver.

But it is far better to use native HID API and not libusb-win32
0.1 for HID device under Windows.

>>
>> By the way, even if libusb-win32 listed two DFU device, your
>> application should not be confused. Why does that happen?
>
> It's confused because it doesn't know which device to program.  It started
> with 1 HID device, 0 DFU devices.  Then the HID device was told to become a
> DFU device, and suddenly there is 0 HID devices and 2 DFU devices.  It claims
> to the user there is more than 1 device.

What if you just use the 1st device or just use the 2nd device?

>> What testlibusb-win.exe says before and after you have this
>> problem? If you can, get another PC to see whether you
>> still have this problem (without install avr32 studio).
>
> testlibusb-win.exe shows 2 devices.  The application works fine on a clean PC.
>
This is kind of strange.
What does "lsusb -vvv" say about your device under Linux?
Does it show two DFU device?

All in all, I suspect this has something to do with the filter
driver. Uninstall it and see if that helps.



--
Xiaofan http://mcuee.blogspot.com

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Libusb-win32-devel mailing list
Libusb-win32-devel@...
https://lists.sourceforge.net/lists/listinfo/libusb-win32-devel

Re: Problems using libusb after installing AVR32 Studio 2.2

by Xiaofan Chen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, Oct 16, 2009 at 1:00 PM, Xiaofan Chen <xiaofanc@...> wrote:

> On Fri, Oct 16, 2009 at 11:21 AM, Frank Tkalcevic
> <frank@...> wrote:
>>> Are you using the libusb-win32 filter driver or the device driver? If
>>> you are using the filter driver, uninstall it and then use device driver.
>>> Then give it a try.
>>
>> What is the difference?  I installed libusb-win32-filter-bin-0.1.12.2.exe.  My
>> device is a plain HID device.  My application works with any HID device.  Is
>> the device driver install suitable?  I just need the libusb interface in my
>> application to access the USB devices.
>
> The filter driver is known to cause problems. Do you have other
> application which access your device using the native HID API?
> If yes, you can not use the libusb-win32 driver. If no, you can
> use the libusb-win32 driver.

Sorry, replace the above "libusb-win32 driver" with
"libusb-win32 device driver".

> But it is far better to use native HID API and not libusb-win32
> 0.1 for HID device under Windows.
>
>>>
>>> By the way, even if libusb-win32 listed two DFU device, your
>>> application should not be confused. Why does that happen?
>>
>> It's confused because it doesn't know which device to program.  It started
>> with 1 HID device, 0 DFU devices.  Then the HID device was told to become a
>> DFU device, and suddenly there is 0 HID devices and 2 DFU devices.  It claims
>> to the user there is more than 1 device.
>
> What if you just use the 1st device or just use the 2nd device?
>
>>> What testlibusb-win.exe says before and after you have this
>>> problem? If you can, get another PC to see whether you
>>> still have this problem (without install avr32 studio).
>>
>> testlibusb-win.exe shows 2 devices.  The application works fine on a clean PC.
>>
> This is kind of strange.
> What does "lsusb -vvv" say about your device under Linux?
> Does it show two DFU device?
>
> All in all, I suspect this has something to do with the filter
> driver. Uninstall it and see if that helps.
>


--
Xiaofan http://mcuee.blogspot.com

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Libusb-win32-devel mailing list
Libusb-win32-devel@...
https://lists.sourceforge.net/lists/listinfo/libusb-win32-devel

Re: Problems using libusb after installing AVR32 Studio 2.2

by Frank Tkalcevic :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> The filter driver is known to cause problems. Do you have other
> application which access your device using the native HID API?
> If yes, you can not use the libusb-win32 driver. If no, you can
> use the libusb-win32 driver.
>
> But it is far better to use native HID API and not libusb-win32
> 0.1 for HID device under Windows.

What kind of problems?  I've read this before but no one has posted details.  
What symptoms should I watch for?

I can't really use the native HID.  The application is available on Windows
and Linux and I don't particularly want to maintain a Windows HID wrapper.  
Once it is all up and running, it goes fine.  I haven't noticed any problems.


>
> >>
> >> By the way, even if libusb-win32 listed two DFU device, your
> >> application should not be confused. Why does that happen?
> >
> > It's confused because it doesn't know which device to program.  It started
> > with 1 HID device, 0 DFU devices.  Then the HID device was told to become a
> > DFU device, and suddenly there is 0 HID devices and 2 DFU devices.  It
claims
> > to the user there is more than 1 device.
>
> What if you just use the 1st device or just use the 2nd device?

I changed my code so it just programs the first device.  But that isn't a
suitable fix.  I need to ensure if someone has two devices plugged in, they
are going to program the write one.


> What does "lsusb -vvv" say about your device under Linux?
> Does it show two DFU device?

Linux is fine.  It only shows 1 device.

I needed AVR32 Studio again, so I reinstalled it.  There is another package,
the avr32-toolchain (compiler, device programmer, etc) which I think is the
culprit.  Part of the install installs something called AVR USB - some kind of
USB drivers.  However, even if I uninstalled it the problem remained.  Any
idea how to locate and force remove the drivers?  How does windows match the
PID/VID to the device driver?


> All in all, I suspect this has something to do with the filter
> driver. Uninstall it and see if that helps.

I did that, then my application didn't work.  The libusb debug shows...

LIBUSB_DLL: info: usb_os_find_busses: found bus-0

And that's it.  No devices.  

So, for an application to list all the devices on my computer, what do I
need?  Just libusb0.dll?  Or libusb0.sys as well.


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Libusb-win32-devel mailing list
Libusb-win32-devel@...
https://lists.sourceforge.net/lists/listinfo/libusb-win32-devel

Re: Problems using libusb after installing AVR32 Studio 2.2

by Xiaofan Chen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, Oct 16, 2009 at 5:03 PM, Frank Tkalcevic
<frank@...> wrote:

>> The filter driver is known to cause problems. Do you have other
>> application which access your device using the native HID API?
>> If yes, you can not use the libusb-win32 driver. If no, you can
>> use the libusb-win32 driver.
>>
>> But it is far better to use native HID API and not libusb-win32
>> 0.1 for HID device under Windows.
>
> What kind of problems?  I've read this before but no one has posted details.
> What symptoms should I watch for?

Some user will lose all the USB device (even your USB mouse and
keyboard), this is especially true for Vista and maybe XP SP3.
Or BSOD.

> I can't really use the native HID.  The application is available on Windows
> and Linux and I don't particularly want to maintain a Windows HID wrapper.
> Once it is all up and running, it goes fine.  I haven't noticed any problems.
>

Actually it is not too bad, many applications use a Windows HID
and Mac OS HID wrapper due to some issues with libusb-win32
and libusb under Mac OS X (you need a codeless kext).

>> All in all, I suspect this has something to do with the filter
>> driver. Uninstall it and see if that helps.
>
> I did that, then my application didn't work.  The libusb debug shows...
>
> LIBUSB_DLL: info: usb_os_find_busses: found bus-0
>
> And that's it.  No devices.
>
> So, for an application to list all the devices on my computer, what do I
> need?  Just libusb0.dll?  Or libusb0.sys as well.
>

You need either the filter driver or the device driver. I will suggest you
uninstall the filter driver and use the device driver instead. You need
to use the INF wizard to create the INF file and to use Windows Device
Manager to "upgrade" the native HID device driver to use libusb-win32
device driver.

The following three reasons make libusb-win32 0.1 not so
well suitable for HID device under Windows.
1) Filter driver is causing problems for quite some users.
2) To use device driver, you need to forgo the native HID driver.
So the vendor application which uses the native HID driver
will not work.
3) libusb-win32 does not work under Vista 64bit without a digital
signature or some hack.

That is why libusb-win32 1.0 is trying to add a native HID wrapper.
But it is not finished yet.


--
Xiaofan http://mcuee.blogspot.com

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Libusb-win32-devel mailing list
Libusb-win32-devel@...
https://lists.sourceforge.net/lists/listinfo/libusb-win32-devel