[android-developers] Re: Android USB problems

2013-09-19 Thread al
Some device types (like a usb mouse) apparently are handled on system level 
and are not exposed to apps. Since different Android devices support 
different usb devices (e.g. usb storage, usb speakers, ...), some types of 
usb devices may be visible on some android devices only...


Am Donnerstag, 19. September 2013 21:55:19 UTC+2 schrieb eli:
>
>    
> **
>   
> I have a tablet, an OTG cable and a barcode reader. I know this works 
> because when I start the Google app I can scan barcodes and see them on the 
> screen.
>
> I created a very simple application that starts the USB manager and checks 
> how many devices are attached.
>
> When I have a memory flash stick in the OTG cable the program shows 1. 
> (correct) 
>
> When I have a mouse in the OTG cable it shows 0. (why)
>
> Interesting observation. When I connect the mouse to the OTG cable it 
> works fine. I use it to click on the button to ask the usbManager how many 
> devices are attached and the response is 0.
>
>  When I attach a barcode reader to the OTG cable, the application goes 
> through onDestroy() and then shows 0. (Why does this happen)
>
> Basics of my program developed using Eclipse:
>
> In onCreate() I have:
>
> usbManager = (UsbManager)getSystemService(Context.USB_SERVICE);
>
>  
>
> In onClick() I have  (there is a button on the screen):
>
> Map usbDeviceList = 
> sbManager.getDeviceList();Toast.makeText(this, String.format("Number of 
> devices = %d", usbDeviceList.size()), Toast.LENGTH_SHORT).show();
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[android-developers] Re: Android USB problems

2013-09-20 Thread eli
How do I get an app to read data from a USB barcode reader if the 
usbManager can't even detect that its there.

On Thursday, September 19, 2013 3:55:19 PM UTC-4, eli wrote:

> 
> **
>   
> I have a tablet, an OTG cable and a barcode reader. I know this works 
> because when I start the Google app I can scan barcodes and see them on the 
> screen.
>
> I created a very simple application that starts the USB manager and checks 
> how many devices are attached.
>
> When I have a memory flash stick in the OTG cable the program shows 1. 
> (correct) 
>
> When I have a mouse in the OTG cable it shows 0. (why)
>
> Interesting observation. When I connect the mouse to the OTG cable it 
> works fine. I use it to click on the button to ask the usbManager how many 
> devices are attached and the response is 0.
>
>  When I attach a barcode reader to the OTG cable, the application goes 
> through onDestroy() and then shows 0. (Why does this happen)
>
> Basics of my program developed using Eclipse:
>
> In onCreate() I have:
>
> usbManager = (UsbManager)getSystemService(Context.USB_SERVICE);
>
>  
>
> In onClick() I have  (there is a button on the screen):
>
> Map usbDeviceList = 
> sbManager.getDeviceList();Toast.makeText(this, String.format("Number of 
> devices = %d", usbDeviceList.size()), Toast.LENGTH_SHORT).show();
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[android-developers] Re: Android USB problems

2013-09-21 Thread al
Probably not with the official usb api. I'm not sure if a port of libusb or 
something on that level may help.

Am Freitag, 20. September 2013 16:03:20 UTC+2 schrieb eli:
>
> How do I get an app to read data from a USB barcode reader if the 
> usbManager can't even detect that its there.
>
> On Thursday, September 19, 2013 3:55:19 PM UTC-4, eli wrote:
>
>> 
>> **
>>   
>> I have a tablet, an OTG cable and a barcode reader. I know this works 
>> because when I start the Google app I can scan barcodes and see them on the 
>> screen.
>>
>> I created a very simple application that starts the USB manager and 
>> checks how many devices are attached.
>>
>> When I have a memory flash stick in the OTG cable the program shows 1. 
>> (correct) 
>>
>> When I have a mouse in the OTG cable it shows 0. (why)
>>
>> Interesting observation. When I connect the mouse to the OTG cable it 
>> works fine. I use it to click on the button to ask the usbManager how many 
>> devices are attached and the response is 0.
>>
>>  When I attach a barcode reader to the OTG cable, the application goes 
>> through onDestroy() and then shows 0. (Why does this happen)
>>
>> Basics of my program developed using Eclipse:
>>
>> In onCreate() I have:
>>
>> usbManager = (UsbManager)getSystemService(Context.USB_SERVICE);
>>
>>  
>>
>> In onClick() I have  (there is a button on the screen):
>>
>> Map usbDeviceList = 
>> sbManager.getDeviceList();Toast.makeText(this, String.format("Number of 
>> devices = %d", usbDeviceList.size()), Toast.LENGTH_SHORT).show();
>>
>>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.