Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (499)
Games in Android Showcase (118)
games submitted by our members
Games in WIP (567)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Getting Additional Controller Information  (Read 2207 times)
0 Members and 1 Guest are viewing this topic.
Offline pkoshar

Junior Newbie





« Posted 2008-01-04 20:55:28 »

Hello,

    Has any headway been made regarding JInput and its ability to provide handling for multiple Controllers of the exact same type? For example, when you receive back an array of Controllers after calling getControllers(), would it be possible to obtain the USB Bus/Port Number (or any other info) that the controller is attached to?
Offline broumbroum

Junior Member





« Reply #1 - Posted 2008-01-04 20:59:39 »

the Controller class provides several methods to retrieve type, port and other properties... Wink

::::... :..... :::::: ;;;:::™ b23:production 2006 GNU/GPL @ http://b23prodtm.webhop.info
on sf.net: /projects/sf3jswing
Java (1.6u10 plz) Web Start pool
dev' VODcast[/ur
Offline pkoshar

Junior Newbie





« Reply #2 - Posted 2008-01-04 21:06:03 »

Right, but whenever I run the ControllerTextTest main class to get the list of controllers, the USB controllers that I'm interested in return the Port Type and Port Number as "Unknown" and "0", respectively.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline broumbroum

Junior Member





« Reply #3 - Posted 2008-01-05 14:03:06 »

did you check the physical device that handles the usb port ? if it is not well supplied then "unknown device" would arise.
I do use the Controller class to provide support for usb gamepads and joysticks, that works well for me.

::::... :..... :::::: ;;;:::™ b23:production 2006 GNU/GPL @ http://b23prodtm.webhop.info
on sf.net: /projects/sf3jswing
Java (1.6u10 plz) Web Start pool
dev' VODcast[/ur
Offline pkoshar

Junior Newbie





« Reply #4 - Posted 2008-01-07 13:08:04 »

Cool, thanks for the info. But how can I tell if my physical device is "well supplied?"
Offline broumbroum

Junior Member





« Reply #5 - Posted 2008-01-08 07:19:20 »

if you use an DC-power unsupplied hub device between the pad and your pc, try plugging directly into the pc usb plug ! Cheesy

::::... :..... :::::: ;;;:::™ b23:production 2006 GNU/GPL @ http://b23prodtm.webhop.info
on sf.net: /projects/sf3jswing
Java (1.6u10 plz) Web Start pool
dev' VODcast[/ur
Offline pkoshar

Junior Newbie





« Reply #6 - Posted 2008-01-08 16:59:11 »

I think I'm already plugging directly into the USB ports actually, and no such luck using the getPortNumber() method. My ultimate goal is to predetermine the ordering of the returned Controller array based on USB push-to-talk (PTT) headset devices I have plugged in. I'm using a Java program called jUSB to obtain the Vendor ID and Product ID of headsets I have plugged in. I can also determine the driver "instance" of the attached headsets. For example, everytime I attach a USB headset into a USB port on my computer for the first time, an entry gets placed into the HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Enum \ USB folder of my registry. The Driver field for the entry is:

{36FC9E60-C465-11CF-8056-444553540000} \ xxxx

, where the value xxxx seems to get incremented each time a headset is intially plugged into a USB port that has never had a headset before. One pseudo-pattern I'm seeing right now is that if one USB port has instance (x) of the headset driver, and the second port has instance (x+1), then the lower-numbered instance (i.e. the first USB port) will have its PTT button status correspond to the first Controller in the Controller array.

I say it's a pseudo-pattern because it's consistent about 90% of the time for devices with identical vendor and product IDs. However, I also have to account for a monaural headset that has the same vendor ID but different product ID. If I have one of these monaural headsets plugged in and another of a different kind plugged in, the monaural headset's PTT button status ALWAYS seems to get placed first into the Controller array.

Am I just spinning my wheels with this approach? I was hoping there would be an easier way. Thanks for the help.
Offline broumbroum

Junior Member





« Reply #7 - Posted 2008-01-08 23:05:29 »

actually JInput is intended for gamepad support not headset, you better try some kind of sound system API.

::::... :..... :::::: ;;;:::™ b23:production 2006 GNU/GPL @ http://b23prodtm.webhop.info
on sf.net: /projects/sf3jswing
Java (1.6u10 plz) Web Start pool
dev' VODcast[/ur
Offline pkoshar

Junior Newbie





« Reply #8 - Posted 2008-01-09 13:12:27 »

I fully intend to use the headset as a game controller, albeit single-button for the PTT. In fact, it's recognized as an "installed game controller" in the Control Panel. I'm handling the audio portion with Java's sound package's Mixer objects. For now, I was just wondering whether there was any correlation between the driver instance # for the headset (which is also a game controller) in the registry and the order in which Controller objects were returned in the array after a getControllers() call (since getPortNumber() doesn't seem to be working). Or should I take another approach to determining the array ordering? Thanks again for the help.
Offline endolf

JGO Coder


Medals: 7


Current project release date: sometime in 3003


« Reply #9 - Posted 2008-01-09 22:29:08 »

Hi

The order the controllers are returned shouldn't be relied upon. Currently it may work, but we have no contract (from a software perspective) to keep it this way. I don't know any instances when the order is not the same as direct input presents them in, but I've not thoroughly tested this as it's not a specified feature.

HTH

Endolf

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline pkoshar

Junior Newbie





« Reply #10 - Posted 2008-01-10 13:16:24 »

Endolf, do you know if anyone else has been having problems getting the getPortNumber() method to work in Controller? If I can't rely on the Controller array order, getPortNumber() seems to be my only other option at this point, and I still can't seem to get it working on Windows or Linux. Thanks for the help.
Offline endolf

JGO Coder


Medals: 7


Current project release date: sometime in 3003


« Reply #11 - Posted 2008-01-10 21:40:53 »

Hi

Under both linux and windows it's not possible as far as I know, using the existing interfaces JInput uses, to obtain the information from the OS as to which port anything is plugged in to.

Endolf

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Pippogeek (39 views)
2014-09-24 16:13:29

Pippogeek (30 views)
2014-09-24 16:12:22

Pippogeek (19 views)
2014-09-24 16:12:06

Grunnt (44 views)
2014-09-23 14:38:19

radar3301 (25 views)
2014-09-21 23:33:17

BurntPizza (62 views)
2014-09-21 02:42:18

BurntPizza (32 views)
2014-09-21 01:30:30

moogie (39 views)
2014-09-21 00:26:15

UprightPath (50 views)
2014-09-20 20:14:06

BurntPizza (54 views)
2014-09-19 03:14:18
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!