Bug 32853 - Android.Hardware.Usb.UsbManager.GetDeviceList() missing
Summary: Android.Hardware.Usb.UsbManager.GetDeviceList() missing
Status: CLOSED ANSWERED
Alias: None
Product: Android
Classification: Xamarin
Component: Bindings ()
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Atsushi Eno
URL:
Depends on:
Blocks:
 
Reported: 2015-08-07 02:47 UTC by Jay Carlson
Modified: 2015-09-14 09:26 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
CLOSED ANSWERED

Description Jay Carlson 2015-08-07 02:47:31 UTC
Right now, the UsbManager bindings only support the GetAccessoryList() method for USB accessories, and not USB devices (which is what's used when the Android device is operating in Host mode).
Comment 1 Atsushi Eno 2015-08-07 02:53:58 UTC
Your problem has nothing to do with Xamarin API binding.

What we return is whatever Android API returns. We don't implement the feature by ourselves. What we instead do is that we invoke the Android API through JNI and return what their Java API returns.

There is no way we filter out certain kinds of USB devices.
Comment 2 Jay Carlson 2015-08-07 04:40:09 UTC
Oops, I wasn't clear at all in my initial bug description (though the title of this bug report is accurate). 

What I meant to say is that the Android.Hardware.Usb.UsbManager is missing the getDeviceList() method that's clearly documented here:
http://developer.android.com/reference/android/hardware/usb/UsbManager.html#getDeviceList()

I opened up the assembly view of Mono.Android, and navigated to Android.Hardware.Usb.UsbManager. This is what I see:
http://i.imgur.com/otUfQT0.png

As you can see, it's missing a GetDeviceList() method that should be there. This function has been in the API since version level 12. I'm targeting level 16.

Does that make sense? Or have I lost my mind?
Comment 3 Atsushi Eno 2015-08-07 05:17:05 UTC
getXxx() method becomes Xxx property. Hence getDeviceList() becomes DeviceList property:
http://developer.xamarin.com/api/property/Android.Hardware.Usb.UsbManager.DeviceList/
Comment 4 Ram Chandra 2015-08-07 05:32:10 UTC
I have checked this issue and observed that the "GetDeviceList() " method does not exist in "UsbManager" class but that class contains the "DeviceList" property and it seems it returns the device hash map.

Screencast: http://www.screencast.com/t/rQarUpUPw

Could you please verify that if it works for you ? For now I am closing this issue feel free to reopen it it you have any concern.

Environment Info:

=== Xamarin Studio ===

Version 5.9.5 (build 9)
Installation UUID: 6ea47b0d-1852-4aaf-808d-373ff0a5002b
Runtime:
	Mono 4.0.3 ((detached/d6946b4)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400030020

=== Xamarin.Android ===

Version: 5.1.3.1 (Business Edition)
Android SDK: /Users/jatin66/Desktop/Backup/android-sdk-macosx
	Supported Android versions:
		2.3    (API level 10)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
Java SDK: /usr
java version "1.7.0_65"
Java(TM) SE Runtime Environment (build 1.7.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

=== Xamarin Android Player ===

Version: Unknown version
Location: /Applications/Xamarin Android Player.app

=== Apple Developer Tools ===

Xcode 6.4 (7720)
Build 6E35b

=== Xamarin.iOS ===

Version: 8.10.4.45 (Business Edition)
Hash: b94bc00
Branch: master
Build date: 2015-08-04 15:26:49-0400

=== Xamarin.Mac ===

Version: 2.0.2.35 (Business Edition)

=== Build Information ===

Release ID: 509050009
Git revision: b99cb19a1d3b15d8980c4616f13f837457e5b292
Build date: 2015-07-28 02:01:44-04
Xamarin addins: d53d6eceb828422f3d4aff8547f2f6bab6c9ea58

=== Operating System ===

Mac OS X 10.10.3
Darwin Dalvik.local 14.3.0 Darwin Kernel Version 14.3.0
    Mon Mar 23 11:59:05 PDT 2015
    root:xnu-2782.20.48~5/RELEASE_X86_64 x86_64
Comment 5 Ram Chandra 2015-09-14 09:26:27 UTC
As the solution is provided in comment3 and comment 4 and we didn't get any response from bug reported. So I am closing this issue.

Please feel free to reopen if you have any concern.