If you still think the device isn't getting your data, I recommend
first tracing the data with Linux's built-in USB data monitor.  If
that shows the data being transferred, I think your next step is
probably getting a USB bus trace machine to really verify that it's
being sent.  Although, I will say that I think it's very unlikely that
Linux is dropping the data silently.  If your data did not get to the
device, javax.usb should give you a error code.

I think it's much more likely that you may be either getting the
device's protocol wrong or simply leaving out command(s).  Maybe you
should get a Windows (software) trace of *everything* going to/from
your device (not just your one specific command) and compare that to a
Linux monitor (software) trace of what you are sending to/getting from
your device.  That is a lot cheaper than getting a hardware bus
tracer.

If you do want to get a hardware bus tracer, I have used most of the
CATC (now owned by LeCroy) bus tracers.  They are all fine tracers,
with relatively good analysis software.  However they are *expensive*.
http://www.lecroy.com/tm/products/ProtocolAnalyzers/usb.asp?menuid=67

I've also used the USB 2.0 model of Ellisys bus tracer.  It's a fine
tracer that will get the job done, but the analysis software is not at
all as good as the LeCroy software.  But, it's a lot less expensive
than the LeCroy tracers.
http://ellisys.com/products/usbex200/index.php

If you're looking for a bus tracer that isn't multi-thousands of
dollars, I have seen one or two around that are "only" in the hundreds
of dollars, but at the time I think it was only USB 1.1 bus speeds,
and I don't know if they are still available.  I don't remember their
names either, but if you googled for usb bus tracer you could probably
find all the options out there.

Make sure you get a USB 2.0 model if you need high-speed tracing.

On 9/13/07, Emanuele Maiarelli <[EMAIL PROTECTED]> wrote:
> i've tried all solutions, but things dosen't change.
> This is the the pice C of code on usb device handling EP1 (Cypres FX2LP):
>
> ...
>    if(!(EP1OUTCS & bmBIT1))
>     {
>         char cmdbuff[10];
>         int cmdsize=0;
>         int i;
>         int bitcount= EP1OUTBC;
>         BOOL stc=FALSE;
>         BOOL done=FALSE;
>         int c=0;
>         while ((c<bitcount) && cmdsize<10 && (!(done)))
>         {
>             if ((stc) && (EP1OUTBUF[c]!=0x03))
> cmdbuff[cmdsize++]=EP1OUTBUF[c];
>             if (EP1OUTBUF[c]==0x02) stc=TRUE;
>             if (EP1OUTBUF[c]==0x03) done=TRUE;
>             c++;
>         }
>         if (cmdsize>0)
>         {
>             if ((cmdbuff[0]=='S') && (cmdbuff[1]=='N'))
>             {
>                 EP1INBUF[0]=0x02;
>                 for (i=0;i<9;i++)
>                 {
>                     EP1INBUF[1+i]=_SNO[i];
>                 }
>                 EP1INBUF[10]=0x03;
>                 EP1INBC=11;
>                 SYNCDELAY;
>             } else
>             {
>                 EP1INBUF[0]=0x02;
>                 EP1INBUF[1]=cmdbuff[0];
>                 EP1INBUF[2]=cmdbuff[1];
>                 EP1INBUF[3]=0x03;
>                 EP1INBC=4;
>                 SYNCDELAY;
>             }
>         }
>
>         EP1OUTBC = 0x40;
>         SYNCDELAY;
>     }
> ....
>
> the device can handle garbage code, looking for a specific STX/ETX
> encapsulated text.
>
> I fear that nothing is being sent to device, dued by the fact that im
> using FC7+SELinux(Disabled), anyone have never tried javax.usb on FC7 ?
>
> Btw can you tell me what is the USB monitor you are using?
>
> At the moment i'm using the device with a C#/Windows solution, but i
> really wants to switch to a Java/Linux one.
>
> Thanks in advice,
>
> Emanuele Maiarelli.
>
> > I don't know specifically why you never get data from your device, it
> > probably is actually not sending anything.  If you think it is, you
> > should enable the Linux usb monitor to see if anything is coming in
> > from your device.
> >
> > As far as your code, it looks basically ok, except for this part:
> >            byte outdata[]=new byte[outmaxPs];
> >            outdata[0]=2;
> >            outdata[1]='S';
> >            outdata[2]='N';
> >            outdata[3]=3;
> >            wrp.setLength(4);
> >            wrp.setData(outdata);
> >
> > that is not doing what you want it to do.  You set the data length to
> > 4 but the call to setData resets it to outmaxPs.  Read the API javadoc
> > interface specification for UsbIrp.setData():
> > http://javax-usb.org/jdoc/javax/usb/UsbIrp.html#setData(byte[])
> >
> >
> > You instead should do either this:
> >            byte outdata[]=new byte[4];
> >            outdata[0]=2;
> >            outdata[1]='S';
> >            outdata[2]='N';
> >            outdata[3]=3;
> >            wrp.setData(outdata);
> >
> > or this:
> >            byte outdata[]=new byte[outmaxPs];
> >            outdata[0]=2;
> >            outdata[1]='S';
> >            outdata[2]='N';
> >            outdata[3]=3;
> >            wrp.setData(outdata, 0, 4);
> >
> > or, this:
> >            byte outdata[]=new byte[outmaxPs];
> >            outdata[0]=2;
> >            outdata[1]='S';
> >            outdata[2]='N';
> >            outdata[3]=3;
> >            wrp.setData(outdata);
> >            wrp.setLength(4);
> >
> > It's possible that is causing your problem, since your device is
> > getting extra garbage bytes sent to it which may confuse it.
> >
> >
> > On 8/27/07, Emanuele Maiarelli <[EMAIL PROTECTED]> wrote:
> >> im running the code below, what happen is that out packet seems to work(
> >> it returns from wp.asyncSubmit(wrp); wrp.waitUntilComplete(); // i've
> >> tried
> >> wp.asyncSubmit(wrp) before) but unless    wp.abortAllSubmissions(); i
> >> got
> >> exception trying wp.close();).
> >> The real problem is that i cannot recive data from the IN endpoint and
> >> rrp.waitUntilComplete(); waits forever.
> >>
> >> I've tested the USB protocol and the data sent in ep1 (OUT) are correct,
> >> in anycase i'll get a answer for errors.
> >>
> >> Thanks in advice,
> >>
> >> import java.util.Hashtable;
> >> import java.util.Iterator;
> >> import java.util.List;
> >> import javax.usb.UsbDevice;
> >> import javax.usb.UsbEndpoint;
> >> import javax.usb.UsbHub;
> >> import javax.usb.UsbInterface;
> >> import javax.usb.UsbIrp;
> >> import javax.usb.UsbPipe;
> >> import javax.usb.util.UsbUtil;
> >>
> >>
> >> /**
> >>  *
> >>  * @author  root
> >>  */
> >> public class DevScan extends javax.swing.JInternalFrame implements
> >> FmkChild
> >> {
> >>     static final int cmdEPw=0x01;
> >>     static final int cmdEPr=0x81;
> >>
> >>     FmkFather Father;
> >>     /** Creates new form DevScan */
> >>     public DevScan() {
> >>         initComponents();
> >>     }
> >>
> >>     public static String getID(UsbDevice d) throws Exception
> >>     {
> >>          String SID=null;
> >>          UsbEndpoint wep=null;
> >>
> >>          UsbEndpoint rep=null;
> >>          List intf=d.getActiveUsbConfiguration().getUsbInterfaces();
> >>          for (int i=0;i<intf.size();i++)
> >>          {
> >>              UsbInterface interf=(UsbInterface) intf.get(i);
> >>              List eps=interf.getUsbEndpoints();
> >>              for (int j=0;j<eps.size();j++)
> >>              {
> >>                  UsbEndpoint ep = (UsbEndpoint) eps.get(j);
> >>                  int
> >> epid=((int)(ep.getUsbEndpointDescriptor().bEndpointAddress()
> >> & 0xFF));
> >>                  if (epid == DevScan.cmdEPw)
> >>                  {
> >>                      wep=ep;
> >>                  }
> >>                  if (epid == DevScan.cmdEPr)
> >>                  {
> >>                      rep=ep;
> >>                  }
> >>
> >>              }
> >>          }
> >>          if ((wep!=null) && (rep!=null))
> >>          {
> >>             int outmaxPs =
> >> wep.getUsbEndpointDescriptor().wMaxPacketSize();
> >>             int inmaxPs=
> >> rep.getUsbEndpointDescriptor().wMaxPacketSize();
> >>             wep.getUsbInterface().claim();
> >>
> >>             //rep.getUsbInterface().claim();
> >>             
> >> System.out.println(wep.getUsbEndpointDescriptor().bEndpointAddress());
> >>             
> >> System.out.println(rep.getUsbEndpointDescriptor().bEndpointAddress());
> >>
> >>             UsbPipe wp=wep.getUsbPipe();
> >>             UsbIrp wrp=wp.createUsbIrp();
> >>
> >>             UsbPipe rp=rep.getUsbPipe();
> >>
> >>
> >>             byte indata[]=new byte[inmaxPs];
> >>
> >>             rp.open();
> >>              UsbIrp rrp=rp.createUsbIrp();
> >>             rrp.setData(indata);
> >>             rrp.setUsbException(null);
> >>
> >>             rp.asyncSubmit(rrp);
> >>
> >>
> >>             wp.open();
> >>
> >>             byte outdata[]=new byte[outmaxPs];
> >>             outdata[0]=2;
> >>             outdata[1]='S';
> >>             outdata[2]='N';
> >>             outdata[3]=3;
> >>             wrp.setLength(4);
> >>             wrp.setData(outdata);
> >>             wrp.setUsbException(null);
> >>
> >>             wp.asyncSubmit(wrp);
> >>
> >>             wrp.waitUntilComplete();
> >>             wrp.setComplete(false);
> >>             wp.abortAllSubmissions();
> >>             wp.close();
> >>             System.out.println("invio");
> >>
> >>             rrp.waitUntilComplete();
> >>             rp.abortAllSubmissions();
> >>             rp.close();
> >>             wep.getUsbInterface().release();
> >>             rep.getUsbInterface().release();
> >>             char[] ss=new char[rrp.getLength()];
> >>             for (int i=0;i<ss.length;i++)
> >>             {
> >>                 System.out.println(UsbUtil.toHexString(indata[i]));
> >>
> >>             }
> >>          }
> >>          return SID;
> >>     }
> >>
> >>     public static void FillUsbTable(Hashtable t,UsbHub hub) throws
> >> Exception
> >>     {
> >>
> >>         List usbdevs=hub.getAttachedUsbDevices();
> >>         Iterator it=usbdevs.iterator();
> >>         t.clear();
> >>         while (it.hasNext())
> >>         {
> >>             UsbDevice d=(UsbDevice) it.next();
> >>             if (d.isUsbHub())
> >>             {
> >>                 DevScan.FillUsbTable(t,(UsbHub)d);
> >>             } else
> >>             {
> >>                if(d.getProductString().equals("MY-USB"))
> >>                {
> >>                    DevScan.getID(d);
> >>                }
> >>             }
> >>         }
> >>     }
> >>
> >>
> >> --
> >> Emanuele Maiarelli
> >>
> >>
> >>
> >>
> >>
> >>
> >> -------------------------------------------------------------------------
> >> This SF.net email is sponsored by: Splunk Inc.
> >> Still grepping through log files to find problems?  Stop.
> >> Now Search log events and configuration files using AJAX and a browser.
> >> Download your FREE copy of Splunk now >>  http://get.splunk.com/
> >> _______________________________________________
> >> javax-usb-devel mailing list
> >> javax-usb-devel@lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/javax-usb-devel
> >>
> >
>
>
> --
> Emanuele Maiarelli
>
>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> 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
>

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
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