giulio | 6 Apr 2009 16:42
Picon

NullPointerException

Hello all,
I'm new to this library and I've a problem.
This source code:

import javax.usb.*;

public class maine
{
public static void main (String [] args) throws SecurityException,
UsbException
{
UsbServices us=UsbHostManager.getUsbServices(); //line 7

}
}

on running displays:

Exception in thread "main" java.lang.NullPointerException
	at javax.usb.UsbHostManager.setupProperties(Unknown Source)
	at javax.usb.UsbHostManager.getProperties(Unknown Source)
	at javax.usb.UsbHostManager.createUsbServices(Unknown Source)
	at javax.usb.UsbHostManager.getUsbServices(Unknown Source)
	at maine.main(maine.java:7)

Why?
(I'm using Eclipse.)

Thanx to who replies me!

(Continue reading)

Hsieh Dinow | 15 Apr 2009 10:41
Picon

How to set up the HID-Device ?

Could someone give me any advices or your experience to my puzzle. 
 

1.      There is a HID device and it's a cable “USB to Serial”.

2.      Firstly I need to initiate this cable with the configuration to set up the baud rate.

3.      That’s all right in DDK with the API è HidD_SetFeature(Device, array, int);

4.      But in Java world, I have spent mass time and still no progress at this step.

5.      Could you give me any advices (API) or examples to set up this initiation.

6.      Whatever thanks your reading.

------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
javax-usb-devel mailing list
javax-usb-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/javax-usb-devel
Hsieh Dinow | 17 Apr 2009 10:25
Picon

My Code

UsbDevice upsUsbDevice = findUPS();                                                       //Find out USBDevice
  if(upsUsbDevice == null){
   System.err.println("There is no any USB to Serial cable attached!");
  }
  UsbConfiguration config = upsUsbDevice.getActiveUsbConfiguration();         //USBDevice => USBConfiguration
  UsbInterface theInterface = config.getUsbInterface((byte)0);                        //USBConfiguration => USBInterface
    
  byte bmRequestType =UsbConst.REQUESTTYPE_DIRECTION_OUT |UsbConst.REQUESTTYPE_TYPE_STANDARD | UsbConst.REQUESTTYPE_RECIPIENT_DEVICE;
  byte bRequest = UsbConst.REQUEST_SET_FEATURE;
  short wValue = UsbConst.DESCRIPTOR_TYPE_DEVICE << 8;
  short wIndex = 0;
  byte[] buffer = new byte[]{0,96,9,0,0,3};
  UsbControlIrp usbControlIrp =upsUsbDevice.createUsbControlIrp(bmRequestType, bRequest, wValue, wIndex);
  usbControlIrp.setData(buffer);
  upsUsbDevice.syncSubmit(usbControlIrp); 
 
//Is any wrong ?
------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
javax-usb-devel mailing list
javax-usb-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/javax-usb-devel
You Qing YQ Rao | 18 Apr 2009 18:14
Picon
Favicon

Can I access USB device in linux directly without USB driver?


Hi All, I have a IrDA device, but I do not have its driver in linux. Can I use jsr80 to send and receive data with the device?

Thanks!  


YouQing Rao(饶有清)
IBM China Systems & Technology Laboratory in Beijing
Internet mail:  yqrao <at> cn.ibm.com    
Tel: 86-10-82453554  
28,ZhongGuanCun Software Park,No.8 Dong Bei Wang West Road, Haidian District Beijing P.R.China 100193
IBM 环宇大厦.北京市海淀区东北旺西路8号,中关村软件园28号楼 100193
------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
javax-usb-devel mailing list
javax-usb-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/javax-usb-devel
Hsieh Dinow | 21 Apr 2009 11:34
Picon

Please give me any advices.

Background : There is an UPS and connecting via the USB. And its USB follows the standard UPS protocol.

Experience : It is capable to get the fixed data, like input voltage, with the API ==> getFeature(Device, buffer, int). In this way, I could get the data, like the input/output voltage, with the unique Report ID.

Aim : I need to get these data with the parameters "Report ID". But I have hit the book and surfed the net for a long while and almost crazy.

Could someone give me an advices or any suggestion to follow?

Whatever thanks your reading?

------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
javax-usb-devel mailing list
javax-usb-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/javax-usb-devel
Dan Streetman | 21 Apr 2009 15:50
Picon

Re: NullPointerException

You need to include more info.  What platform?  What packages do you
have?  Did you include the properties file?  etc.

On Mon, Apr 6, 2009 at 10:42 AM, giulio <julius.g <at> alice.it> wrote:
> Hello all,
> I'm new to this library and I've a problem.
> This source code:
>
> import javax.usb.*;
>
> public class maine
> {
> public static void main (String [] args) throws SecurityException,
> UsbException
> {
> UsbServices us=UsbHostManager.getUsbServices(); //line 7
>
> }
> }
>
> on running displays:
>
> Exception in thread "main" java.lang.NullPointerException
>        at javax.usb.UsbHostManager.setupProperties(Unknown Source)
>        at javax.usb.UsbHostManager.getProperties(Unknown Source)
>        at javax.usb.UsbHostManager.createUsbServices(Unknown Source)
>        at javax.usb.UsbHostManager.getUsbServices(Unknown Source)
>        at maine.main(maine.java:7)
>
> Why?
> (I'm using Eclipse.)
>
> Thanx to who replies me!
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> javax-usb-devel mailing list
> javax-usb-devel <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/javax-usb-devel
>

------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
javax-usb-devel mailing list
javax-usb-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/javax-usb-devel
Dan Streetman | 21 Apr 2009 15:51
Picon

Re: How to set up the HID-Device ?

I HIGHLY recommend you let your OS handle the USB to RS232 conversion
and you use javax.comm to talk to the serial port.

2009/4/15 Hsieh Dinow <dinow46 <at> gmail.com>:
> Could someone give me any advices or your experience to my puzzle.
>
>
> 1.      There is a HID device and it's a cable “USB to Serial”.
>
> 2.      Firstly I need to initiate this cable with the configuration to set
> up the baud rate.
>
> 3.      That’s all right in DDK with the API è HidD_SetFeature(Device,
> array, int);
>
> 4.      But in Java world, I have spent mass time and still no progress at
> this step.
>
> 5.      Could you give me any advices (API) or examples to set up this
> initiation.
>
> 6.      Whatever thanks your reading.
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> High Quality Requirements in a Collaborative Environment.
> Download a free trial of Rational Requirements Composer Now!
> http://p.sf.net/sfu/www-ibm-com
> _______________________________________________
> javax-usb-devel mailing list
> javax-usb-devel <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/javax-usb-devel
>
>

------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
javax-usb-devel mailing list
javax-usb-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/javax-usb-devel
Dan Streetman | 21 Apr 2009 15:46
Picon

Re: (no subject)

> If yes, could you tell me where I could get the latest version components
> from the websit?

From the sourceforge project page of course.

2009/3/30 Hsieh Dinow <dinow46 <at> gmail.com>:
> Hello Dan Streetman
>
>                  Appreciate your advices
>
> I have upgraded the components with the newly version
> (jsr80-1.0.1.jar, jsr80_ri-1.0.1.jar, jsr80_linux-1.0.1.jar, and
> libJavaxUsb.so.1.0.1)
> from the website
> http://ftp.heanet.ie/pub/sourceforge/j/ja/javax-usb/.
> And the consequence is good without any exceptions.
>
> But from your former mention, the latest version is 1.0.2 right?
> If yes, could you tell me where I could get the latest version components
> from the websit?
>
> Thanks you again.
> ------------------------------------------------------------------------------
>
> _______________________________________________
> javax-usb-devel mailing list
> javax-usb-devel <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/javax-usb-devel
>
>

------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
javax-usb-devel mailing list
javax-usb-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/javax-usb-devel
Dan Streetman | 21 Apr 2009 15:53
Picon

Re: My Code

I don't know what you are trying to do, so I can't say if it's right or wrong.

2009/4/17 Hsieh Dinow <dinow46 <at> gmail.com>:
> UsbDevice upsUsbDevice =
>
findUPS();                                                     
 //Find out
> USBDevice
>   if(upsUsbDevice == null){
>    System.err.println("There is no any USB to Serial cable attached!");
>   }
>   UsbConfiguration config =
> upsUsbDevice.getActiveUsbConfiguration();         //USBDevice =>
> USBConfiguration
>   UsbInterface theInterface =
> config.getUsbInterface((byte)0);                        //USBConfiguration
> => USBInterface
>
>   byte bmRequestType =UsbConst.REQUESTTYPE_DIRECTION_OUT
> |UsbConst.REQUESTTYPE_TYPE_STANDARD | UsbConst.REQUESTTYPE_RECIPIENT_DEVICE;
>   byte bRequest = UsbConst.REQUEST_SET_FEATURE;
>   short wValue = UsbConst.DESCRIPTOR_TYPE_DEVICE << 8;
>   short wIndex = 0;
>   byte[] buffer = new byte[]{0,96,9,0,0,3};
>   UsbControlIrp usbControlIrp
> =upsUsbDevice.createUsbControlIrp(bmRequestType, bRequest, wValue, wIndex);
>   usbControlIrp.setData(buffer);
>   upsUsbDevice.syncSubmit(usbControlIrp);
>
> //Is any wrong ?
> ------------------------------------------------------------------------------
> Stay on top of everything new and different, both inside and
> around Java (TM) technology - register by April 22, and save
> $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
> 300 plus technical and hands-on sessions. Register today.
> Use priority code J9JMT32. http://p.sf.net/sfu/p
> _______________________________________________
> javax-usb-devel mailing list
> javax-usb-devel <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/javax-usb-devel
>
>

------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
javax-usb-devel mailing list
javax-usb-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/javax-usb-devel
Dan Streetman | 21 Apr 2009 15:54
Picon

Re: Can I access USB device in linux directly without USB driver?

javax.usb allows direct access to USB devices.  So I would guess no,
you can't use it to talk to a IrDA device.

2009/4/18 You Qing YQ Rao <yqrao <at> cn.ibm.com>:
>
> Hi All, I have a IrDA device, but I do not have its driver in linux. Can I
> use jsr80 to send and receive data with the device?
>
> Thanks!
>
>
> YouQing Rao(饶有清)
> IBM China Systems & Technology Laboratory in Beijing
> Internet mail:  yqrao <at> cn.ibm.com
> Tel: 86-10-82453554
> 28,ZhongGuanCun Software Park,No.8 Dong Bei Wang West Road, Haidian District
> Beijing P.R.China 100193
> IBM 环宇大厦.北京市海淀区东北旺西路8号,中关村软件园28号楼 100193
> ------------------------------------------------------------------------------
> Stay on top of everything new and different, both inside and
> around Java (TM) technology - register by April 22, and save
> $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
> 300 plus technical and hands-on sessions. Register today.
> Use priority code J9JMT32. http://p.sf.net/sfu/p
> _______________________________________________
> javax-usb-devel mailing list
> javax-usb-devel <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/javax-usb-devel
>
>

------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
javax-usb-devel mailing list
javax-usb-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/javax-usb-devel

Gmane