You need to pick one: 1. You use the system driver you installed, and you talk to the driver interface (it looks like "/dev/cm15a0" from your perl code)
2. You use javax.usb to talk directly to your USB device You can't have both. You talk directly to USB devices with javax.usb. You don't talk to USB device drivers with javax.usb. I suggest you talk directly to your driver interface. You need to be familiar with how to use the java.io package to open the device node and send/receive data from it. On Fri, Feb 13, 2009 at 3:16 PM, Pascal VERRECCHIA <pascal.verrecc...@gmail.com> wrote: > Hi Dan and thank you for your answer. > > To make my request more comprehensive, I'm trying to drive a CM15 module > which is a X10 controller for home automation (domotic) with Java. Here is > the component : > http://www.automatedhome.co.uk/New-Products/X10-CM15-Pro-Review.html > Thanks to that stuff, I'm trying to light on and light off X10 module AM12 > (http://www.reallycleverhomes.co.uk/acatalog/Marmitek_AM12_X10_plug_in_appliance_module.html) > and I need to give orders by my CM15. > > I have installed driver for CM15 on my debian system using this generic USB > : http://www.linuxha.com/USB/ > > My CM15 is well detected by the system. > > In my test class, I detected this material with this code : > > UsbHub virtualRootUsbHub = ShowTopology.getVirtualRootUsbHub(); > > List allUsbDevices = FindUsbDevice.getAllUsbDevices(virtualRootUsbHub); > List usbHubs = FindUsbDevice.getUsbDevicesWithDeviceClass(virtualRootUsbHub, > UsbConst.HUB_CLASSCODE); > System.out.println("Found " + allUsbDevices.size() + " devices total."); > System.out.println("Found " + usbHubs.size() + " hubs."); > allUsbDevices.removeAll(usbHubs); > UsbDevice usbDev = (UsbDevice) allUsbDevices.get(0); > > udbDev in this code corresponds correctly at my CM15 component. > > I have used this script perl example to verify that all is well configured : > > use Fcntl; > > sysopen( CM15A, "/dev/cm15a0", O_RDWR |O_NOCTTY | O_NONBLOCK ) || die > "Cannot open device $!"; > syswrite CM15A, pack( "CC", 4, 0x61 ), 2; > sleep 1; # can be less > syswrite CM15A, pack( "CC", 6, 0x62 ), 2; # ON > #syswrite CM15A, pack( "CC", 6, 0x63 ), 2; # OFF > close( CM15A ); > > When I try this example, I can light on and off my lamp without a problem. > > I'm trying to do the same in Java with javax.usb. > > As I write in my previous mail, here is my code : > > byte bmRequestType = > UsbConst.REQUESTTYPE_DIRECTION_IN | > UsbConst.REQUESTTYPE_TYPE_STANDARD | UsbConst.REQUESTTYPE_RECIPIENT_DEVICE; > byte bRequest = UsbConst.REQUEST_GET_CONFIGURATION; > short wValue = 0; > short wIndex = 0; > byte[] buffer = new byte[256]; > buffer[0] = (byte) 0x62; > UsbControlIrp usbControlIrp = > usbDev.createUsbControlIrp(bmRequestType, bRequest, wValue, wIndex); > usbControlIrp.setData(buffer); > usbDev.syncSubmit(usbControlIrp); > > I reuse code I see in examples on SourceForge but this doesn't work... > I'm not sure because I'm not familiar at all with javax.usb but my > bmRequestType and/or my bRequest mustn't be well declared. > > Concretly, I need to send this data : 0x62 to my USB component... > What is wrong in my code? > > Thanks again for your help! > > Pascal VERRECCHIA > > > 2009/2/13 Dan Streetman <ddstr...@ieee.org> >> >> First, read this FAQ question. >> http://javax-usb.org/faq.html#talk_to_device >> >> On Fri, Feb 13, 2009 at 8:17 AM, Pascal VERRECCHIA >> <pascal.verrecc...@gmail.com> wrote: >> > For the moment, I installed suscessfully the CM15 driver on a Debian >> > system >> >> what "CM15 driver"? >> >> > In a first time, for a very simple test, I need to send to my CM15 >> > device >> > this data : 0x62. This should light a lamp in a room. For information, I >> > found a perl script example to drive CM15, test it with this data and it >> > works great. >> >> You think showing us the perl script might help? ;-) >> >> > Here is my code (as you can see I used the examples) : >> >> Unless someone on the list has previous experience with your device, >> we can't help you with your device's protocol. See the answer to the >> FAQ question referenced above. If you have a perl script that shows >> what the device protocol is, you need to send that to us so we we >> *may* be able to help you figure out the protocol. However keep in >> mind that if it's a 1000-line script and the protocol is complicated, >> probably nobody will care to review it :) > > > ------------------------------------------------------------------------------ > Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA > -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise > -Strategies to boost innovation and cut costs with open source participation > -Receive a $600 discount off the registration fee with the source code: SFAD > http://p.sf.net/sfu/XcvMzF8H > _______________________________________________ > javax-usb-devel mailing list > javax-usb-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/javax-usb-devel > > ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ javax-usb-devel mailing list javax-usb-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/javax-usb-devel