Elliotte Harold | 2 Jan 2006 15:42
Picon

Minor editorial issues in spec

A few minor issues for an eventual maintenance release.

In the PDF spec

"buffer the imeplementation should use when transferring data."

"imeplementation" --> "implmentation"

Many of the figures such as 3, 4, 5, and 6 seem to switch between right 
aligned and left-aligned method signatures for no obvious reason.

--

-- 
Elliotte Rusty Harold  elharo <at> metalab.unc.edu
XML in a Nutshell 3rd Edition Just Published!
http://www.cafeconleche.org/books/xian3/
http://www.amazon.com/exec/obidos/ISBN=0596007647/cafeaulaitA/ref=nosim

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
Elliotte Harold | 2 Jan 2006 15:56
Picon

Re: Minor editorial issues in spec

Another one: "Short packets will happen if the device transferrs less 
data than the host was expecting."

"transferrs" --> "transfers"

--

-- 
Elliotte Rusty Harold  elharo <at> metalab.unc.edu
XML in a Nutshell 3rd Edition Just Published!
http://www.cafeconleche.org/books/xian3/
http://www.amazon.com/exec/obidos/ISBN=0596007647/cafeaulaitA/ref=nosim

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
Alireza Bakhtiari | 5 Jan 2006 09:07
Picon
Favicon

gsm modem response is always 1'

hi everyone
I have a usb gsm modem (siemens MC35) and i wanna send an sms through this modem, but whatever command I send to the modem, the response is the same:1'
this is what i have done:

final UsbPipe usbPipein = usbEndpointin.getUsbPipe();
final UsbPipe usbPipeout = usbEndpointout.getUsbPipe();
//I had to define them as final to be able to work with them in the thread
after that i open the pipes, then:


Thread runner1 = new Thread () {
            public void run () {
                UsbIrp irp = usbPipeout.createUsbIrp();
                irp.setData("ATI".getBytes());

               try{
                   usbPipeout.syncSubmit(irp);
                   Thread.sleep(1000);

               if (1 > irp.getActualLength()){
                     System.out.print("failed");
                   throw new Exception("packet sending failed");
               }
               }catch(Exception e){};
            }};
          
        Thread runner2 = new Thread () {
            public void run () {
                byte[] resData = new byte[64];
                try{
                     Thread.sleep(1000);
                      UsbIrp inIrp = usbPipein.createUsbIrp();
                     inIrp.setData(resData);
                     int bytesRead = 0;
                     do{
                       usbPipein.syncSubmit(inIrp);
                       bytesRead = inIrp.getActualLength();
                       totalBytes += bytesRead;
                     } while (!inIrp.isComplete());
                        System.out.println("response: "+new String(resData,0,totalBytes));
                }catch(Exception e){}
            }};
          runner2.start ();
          runner1.start ();

if i set the sleep time of thread 2 to be 2000 or more, it will catch an exception
Im dont know much of usb programming, please help me correct the code.
Yours,
Alireza

Yahoo! Photos
Ring in the New Year with Photo Calendars. Add photos, events, holidays, whatever.
Dan Streetman | 7 Jan 2006 17:31
Picon

Re: USB Blinken Lights


I don't know of any, unfortunately.  The easiest thing to do might be to 
take control of a USB keyboard and toggle its LEDs.  The commands should 
be fairly easy (standard), although I'm not entirely sure if the Linux HID 
module will correctly let go of it.

On Fri, 30 Dec 2005, Elliotte Harold wrote:

>Anyone know of a simple device that's operated purely over the control 
>channel? Possibly in write-only mode? Perhaps something as simple as a 
>light or LED that can switch on or off.
>
>I'd like to be able to show some sort of demo of this stuff relatively 
>early with just the UsbDevice class without having to first introduce 
>UsbConfiguration, UsbInterface, UsbEndpoint, and finally UsbPipe. By the 
>time I work my way through all that, I'm afraid my audience will have 
>departed for dreamland if I haven't actually shown them a simple working 
>program that accomplishes something.
>
>Possibly I could even hook up such a device myself, but I'm not a 
>hardware person by training, so I'd be more comfortable with a 
>prepackaged solution that doesn't require me to read circuit diagrams. :-)
>
>

--

-- 
Dan Streetman
ddstreet <at> ieee.org
---------------------
186,272 miles per second:
It isn't just a good idea, it's the law!

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
Dan Streetman | 7 Jan 2006 17:38
Picon

Re: Why is UsbDisconnectedException a runtime exception?


Originally (before final approval) it wasn't declared anywhere, since it
can be thrown in a very large number of places.  Only RuntimeExceptions
can be thrown without being declared.  Now, it is declared in all places 
that it can be thrown, so it could be a normal Excpetion (UsbException).  
Part of the thinking was it reflects an exception that has occured 
independent of any programming error, but in hindsight that's not a good 
reason, as disconnects are inevitable and all USB apps have to be prepared 
for them to happen.

Probably in the next rev of the API it should change...unfortunately, that 
would be a non-backwards compatible change, since programs that previously 
didn't catch it would not compile...

Why don't you open a bug or feature request for that?

On Sat, 31 Dec 2005, Elliotte Harold wrote:

>I'm curious. What's the reasoning behind making UsbDisconnectedException 
>a runtime exception? A disconnected device on the bus is an 
>environmental condition that cannot be predicted or tested for in 
>advance. It does not indicate a programming error. This seems like 
>exactly the place for a checked exception. Why is this one exception 
>pulled out as a runtime exception when most UsbExceptions are checked? 
>What am I not seeing here?
>
>

--

-- 
Dan Streetman
ddstreet <at> ieee.org
---------------------
186,272 miles per second:
It isn't just a good idea, it's the law!

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
Dan Streetman | 7 Jan 2006 17:44
Picon

Re: Minor editorial issues in spec


Thanks, changed.

On Mon, 2 Jan 2006, Elliotte Harold wrote:

>Another one: "Short packets will happen if the device transferrs less 
>data than the host was expecting."
>
>"transferrs" --> "transfers"
>
>

--

-- 
Dan Streetman
ddstreet <at> ieee.org
---------------------
186,272 miles per second:
It isn't just a good idea, it's the law!

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
Dan Streetman | 7 Jan 2006 17:45
Picon

Re: Minor editorial issues in spec


On Mon, 2 Jan 2006, Elliotte Harold wrote:

>A few minor issues for an eventual maintenance release.
>
>In the PDF spec
>
>"buffer the imeplementation should use when transferring data."
>
>"imeplementation" --> "implmentation"

Funny, you misspelled it too :)

Thanks, changed (to the correct spelling ;-)

--

-- 
Dan Streetman
ddstreet <at> ieee.org
---------------------
186,272 miles per second:
It isn't just a good idea, it's the law!

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
Dan Streetman | 7 Jan 2006 18:05
Picon

Re: gsm modem response is always 1'


On Thu, 5 Jan 2006, Alireza Bakhtiari wrote:

>hi everyone
> I have a usb gsm modem (siemens MC35) and i wanna send an sms through this modem, but whatever command I send
to the modem, the response is the same:1'
> this is what i have done:

You get "1" as the response?  Do you mean it successfully transfers only 1 
byte?

> 
> final UsbPipe usbPipein = usbEndpointin.getUsbPipe();
> final UsbPipe usbPipeout = usbEndpointout.getUsbPipe();
> //I had to define them as final to be able to work with them in the thread
> after that i open the pipes, then:
> 
> 
> Thread runner1 = new Thread () {
>             public void run () {
>                 UsbIrp irp = usbPipeout.createUsbIrp();
>                 irp.setData("ATI".getBytes());

This probably isn't what you want to do, as "ATI".getBytes() will convert 
it to 16-bit unicode, not ascii (8-bit) bytes.  You'll need to either 
explicitly create the byte array with the right values or use one of the 
String (or related classes) ASCII conversion methods, if that's what you 
want.

Probably easiest to do something like
byte[] data = { 'A', 'T', 'I' };
although I'm not actually sure Java allows byte[] construction like that.

> 
>                try{
>                    usbPipeout.syncSubmit(irp);
>                    Thread.sleep(1000);

syncSubmit guarantees that the transfer is done when the method returns.  
No point in sleeping at all.

> 
>                if (1 > irp.getActualLength()){
>                      System.out.print("failed");
>                    throw new Exception("packet sending failed");
>                }
>                }catch(Exception e){};

You don't want to even print something out at least if there is an 
exception?

>             }};
>            
>         Thread runner2 = new Thread () {
>             public void run () {
>                 byte[] resData = new byte[64];
>                 try{
>                      Thread.sleep(1000);

why?

>                       UsbIrp inIrp = usbPipein.createUsbIrp();
>                      inIrp.setData(resData);
>                      int bytesRead = 0;
>                      do{
>                        usbPipein.syncSubmit(inIrp);
>                        bytesRead = inIrp.getActualLength();
>                        totalBytes += bytesRead;
>                      } while (!inIrp.isComplete());

that's pointless, any submit method guarantees the irp will be complete on 
return.

>                         System.out.println("response: "+new String(resData,0,totalBytes));
>                 }catch(Exception e){}
>             }};
>           runner2.start ();
>           runner1.start ();
> 
> if i set the sleep time of thread 2 to be 2000 or more, it will catch an exception
> Im dont know much of usb programming, please help me correct the code. 

Have you read Chaps 5 and 9 of the USB spec?  Those will help a lot.  
Also, javax.usb JavaDOC is your friend...
http://javax-usb.org/jdoc/

--

-- 
Dan Streetman
ddstreet <at> ieee.org
---------------------
186,272 miles per second:
It isn't just a good idea, it's the law!

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
Adam Megacz | 3 Jan 2006 06:44
Picon
Favicon

most up-to-date/maintained USB impl for Java?


Hi there.  I've noticed that there seem to be a lot of "USB for
Java" projects out there, most in varying states of abandon.  This one
seems to have an active mailing list, which is great, although the
webpage javax-usb.sourceforge.net has that "not edited since 1995"
look to it, which I think might scare people away.

Anyways, is this sourceforge project the "most maintained"
implementation of javax.usb?  Also, what is the current status (for
this project or any other) of support on Windows and Mac OS X?  I
might be interested in helping implement/finish the latter.

Thanks for any pointers,

  - a

--
PGP/GPG: 5C9F F366 C9CF 2145 E770  B1B8 EFB1 462D A146 C380

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
Dan Streetman | 9 Jan 2006 07:22
Picon

Re: most up-to-date/maintained USB impl for Java?


On Mon, 2 Jan 2006, Adam Megacz wrote:

>Hi there.  I've noticed that there seem to be a lot of "USB for
>Java" projects out there, most in varying states of abandon.  This one
>seems to have an active mailing list, which is great, although the
>webpage javax-usb.sourceforge.net has that "not edited since 1995"
>look to it, which I think might scare people away.

I was actually going for '70s green-only CRT... ;)

>
>Anyways, is this sourceforge project the "most maintained"
>implementation of javax.usb?  Also, what is the current status (for
>this project or any other) of support on Windows and Mac OS X?  I
>might be interested in helping implement/finish the latter.

See the FAQ (no implementation for MAX OS X, feel free to create one 
yourself... :)

--

-- 
Dan Streetman
ddstreet <at> ieee.org
---------------------
186,272 miles per second:
It isn't just a good idea, it's the law!

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click

Gmane