Hi @ all 

I am new at this mailing list and my English + Java Knowledge are not
the best ;) (plz keep patient)

So I use the JSR80 - API (thx god for this peace Software *G*) + I got
from Garmin this Specification of the Garmin Protocol
http://www8.garmin.com/support/commProtocol.html

I only want to send/recieve Data to/from the Device (Garmin eTrex
Vista).

With the help of this Code, I can figured out which Devices and Hubs are
connected to my PC.

************************************************************
public class USBLister{
        public USBLister() {    
                UsbServices services;
                try {
                        services = UsbHostManager.getUsbServices();
                        UsbHub vroothub = services.getRootUsbHub();
                        String s=vroothub.toString();
                        System.out.println(s);
                        listDevices(vroothub);
                } catch (SecurityException e) {
                        e.printStackTrace();
                } catch (UsbException e) {
                        e.printStackTrace();
                }
                                
        }
        
        public void listDevices(UsbHub hub){
                List Devices = hub.getAttachedUsbDevices();
                Iterator iterator = Devices.iterator();
                while (iterator.hasNext()) {
                        UsbDevice device = (UsbDevice) iterator.next();
                        if (device.isUsbHub()) {
                                System.out.println("HUB: "+ device);
                                listDevices((UsbHub) device);
                        }else{
                                System.out.println("Device: "+ device);
                        try{
                                UsbDeviceDescriptor descriptor = 
device.getUsbDeviceDescriptor();
                                //Id Vendor - später um es zu identifizieren
                                System.out.println("IdVendor: 
"+descriptor.idVendor());
                                System.out.println("IdProduct: 
"+descriptor.idProduct());
                        }catch(Exception ex){}
                }
              } 
        }
}

Can anyone give me a Tipp how to speak with the Device ?
I used this Code:

public void IODevices(UsbDevice device){
                try{
                        UsbConfiguration config = 
device.getActiveUsbConfiguration();
                        List totalInterfaces = config.getUsbInterfaces();
                        for (int i=0; i<totalInterfaces.size(); i++){
                                UsbInterface interf = (UsbInterface) 
totalInterfaces.get(i);
                                interf.claim(new UsbInterfacePolicy() {
                                      public boolean forceClaim(UsbInterface 
usbInterface) {
                                        return true;
                                      }
                                });
                                List totalEndpoints = interf.getUsbEndpoints();
                                for (int j = 0; j < totalEndpoints.size(); j++){
                                        UsbEndpoint ep = (UsbEndpoint) 
totalEndpoints.get(j);
                                        System.out.println(j);
                                        
System.out.println("***********************************");
                                        System.out.println("Direction: 
"+ep.getDirection());
                                        System.out.println("Descriptor: 
"+ep.getUsbEndpointDescriptor());
                                        System.out.println("Type: 
"+ep.getType());
                                        
System.out.println("***********************************");
                                }
                        }
        }


How to figure out which is the Bulk In or Bulk out ? 
My Output is this one:

[EMAIL PROTECTED]
HUB: [EMAIL PROTECTED]
HUB: [EMAIL PROTECTED]
HUB: [EMAIL PROTECTED]
Device: [EMAIL PROTECTED]
0
***********************************
Direction: -128
Descriptor: bLength : 7
bDescriptorType : 0x05
bEndpointAddress : 0x81
bmAttributes : 0x02
wMaxPacketSize : 64
bInterval : 0

Type: 2
***********************************
1
***********************************
Direction: -128
Descriptor: bLength : 7
bDescriptorType : 0x05
bEndpointAddress : 0x82
bmAttributes : 0x03
wMaxPacketSize : 64
bInterval : 1

Type: 3
***********************************
2
***********************************
Direction: 0
Descriptor: bLength : 7
bDescriptorType : 0x05
bEndpointAddress : 0x03
bmAttributes : 0x02
wMaxPacketSize : 64
bInterval : 0

Type: 2
***********************************
IdVendor: 2334
IdProduct: 3
HUB: [EMAIL PROTECTED]
HUB: [EMAIL PROTECTED]
HUB: [EMAIL PROTECTED]


---------------------------------------------------

Thx for every tipp ;) 

greets uter




-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
javax-usb-devel mailing list
javax-usb-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/javax-usb-devel

Reply via email to