On Thu, 17 Mar 2005, Brad BARCLAY wrote: >I've registered for a new SourceForge project to >keep the source in (UNIX name "javaxusbosx"), and hopefully will be >able to put a skeleton and a small team together to make this happen.
If you want, I can add you as a developer and create a new CVS package for the MacOSX imp... > I hope you won't mind if I ask some (perhaps apparently trivial) >questions to get the ball rolling. sure! :) > Sounds good -- but I guess that before I implement a UsbServices >package, I'll need to wrap my brain around how to construct the >topology. What is the proper way to do this? Should I (for example) >create my own classes that implement (for example) the UsbDevice >interface, or should I use the UsbDeviceImp class? On that subject, >how do the Usb*Imp classes fit in to all of this? It's relatively easy...of course "relatively" is a relative word :) Do use all the common RI classes, i.e. UsbDeviceImp, UsbConfigurationImp, UsbInterfaceImp, etc. Most of the classes can handle 100% implementing the API. There are only a few that actually need to talk to the platform imp, i.e. UsbDeviceImp, UsbInterfaceImp, and UsbPipeImp. So when you create new instances of those classes, you also need to give some way to talk to the platform imp. Each one therefore has a os-specific interface in the com.ibm.jpos.os package, i.e. UsbDeviceOsImp, UsbInterfaceOsImp, and UsbPipeOsImp (and UsbControlPipeOsImp...). For example, when you create a UsbDeviceImp, you need to pass it an instance of the UsbDeviceOsImp interface. When the UsbDeviceImp gets a UsbIrp to submit, it passes it down to the UsbDeviceOsImp instance, who is expected to actually do the platform-specific work to send/receive the data in the UsbIrp. First, you should create a UsbHubImp topology representation of each Host Controller in your system. Since UsbHubImps are (extend) UsbDeviceImps, it's the same process as creating a UsbDeviceImp with an extra parameter (i.e. the number of ports). Create the full device-topology for each hub (i.e. create and set up the UsbHubImp, UsbConfigurationImp(s), etc. all the way down to the UsbEndpointImp(s) and UsbPipeImp(s)). Create the os-specific instances (e.g. UsbDeviceOsImp, etc) and pass those to the UsbHubImp, etc. objects you just created. You can keep any platform-specific info in the os-specific objects you create. Once all that is set up, the last thing to do is connect the UsbHubImp up to its parent UsbHubImp (in this case the virtual UsbHubImp provided/created by the AbstractUsbServices class, assuming you are using it). You can use the UsbDeviceImp.connect() method to do this. Then, continue for each connected device you find. Keep in mind that as soon as you call the UsbDeviceImp.connect() method (or, pass the UsbDevice to the UsbServicesListener.usbDeviceAttached() method), applications can immediately begin using it. So it should be ready for use... > One thing I'm not yet clear on, is how does the common portion of the >API know what native classes to connect into? I didn't see any >property files ala the Java Comm API for denoting what native >implementation classes to use anywhere. The whole javax.usb subsystem is started by the platform implementation's UsbServices implementation, which is specified in the required javax.usb.properties file. The platform implementation must provide this file, and specify (at least) the parameter "javax.usb.services=<your class>" The API class javax.usb.UsbHostManager uses this to instantiate (via reflection) the class you specify. The common RI has several settings that can be present in the javax.usb.properties file. Those are documented in the common RI's docs/ directory in a sample javax.usb.properties file. Each common RI object uses the os-specific objects passed to them, as described above. e.g., a UsbDeviceImp object calls its getUsbDeviceOsImp() method to talk to the platform-specific UsbDeviceOsImp object. > Thanks for your help thus far. I'm hoping if I can get the pure Java >portion started and the JNI headers generated, I can get some community >participation to help implement everything. > > Please expect me over the coming months to use this mailing list to >continue to ask questions :). I'll be here! :) -- Dan Streetman [EMAIL PROTECTED] --------------------- 186,272 miles per second: It isn't just a good idea, it's the law! ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ javax-usb-devel mailing list javax-usb-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/javax-usb-devel