Main > Linux
Attempting to hack and document GunCon2 for Linux, FreeBSD, and MacOS X.
Numbski:
I'm going to start by copying my little binary cheat-sheet again:
--- Code: ---0000 - 0
0001 - 1
0010 - 2
0011 - 3
0100 - 4
0101 - 5
0110 - 6
0111 - 7
1000 - 8
1001 - 9
1010 - A
1011 - B
1100 - C
1101 - D
1110 - E
1111 - F
--- End code ---
If someone can help me reconcile this math problem too, I'd appreciate it. From the TopGun Driver:
--- Code: --- input_report_key(dev, BTN_A, !(data[0] & 0x04));
input_report_key(dev, BTN_B, !(data[0] & 0x08));
input_report_key(dev, BTN_C, !(data[0] & 0x02));
input_report_key(dev, BTN_TRIGGER, !(data[1] & 0x20));
input_report_key(dev, BTN_START, !(data[1] & 0x80));
input_report_key(dev, BTN_SELECT, !(data[1] & 0x40));
--- End code ---
I've figured out that the data[0] array is the first byte from the left, and data[1] is the second byte from the left, so we're in agreement there. data[0] then looks like this:
--- Code: ---0111 1111 - Left - bit 8
1011 1111 - Down - bit 7
1101 1111 - Right - bit 6
1110 1111 - Up - bit 5
1111 0111 - A - bit 4
1111 1011 - B - bit 3
1111 1101 - C - bit 2
1111 1110 - ? - bit 1
--- End code ---
He says the C button is 0x02. Correct.
He says the A button is 0x04. No....0x04 is the third bit, or the B button. A button is the 4th bit, but not 0x04.
He says the B button is 0x08. Hmm? 0x08 is the 4th bit. The A button. Hmm???
Even more bizarre. Here's data[1]:
--- Code: ---0111 1111 - Start - bit 8
1011 1111 - Select - bit 7
1101 1111 - Trigger - bit 6
1110 1111 - ? - bit 5
--- End code ---
He says the trigger is 0x20. Bit 6. That's correct.
He says that select is 0x40. That's bit 7. That's correct.
He says that start is 0x08. That's bit 8. So is he suffering from A/B button dislexia, or am I?
(Update: Just verified that my code is correct. So unless the TopGun has A and B flipped, I'm right and he's wrong. :P Also chatting on AIM with Acorns as we speak. w00t!)
Smog:
start is 0x80
#define BUTTON_B 0x0400
#define BUTTON_TRIGGER_1 0x0020
#define BUTTON_TRIGGER_2 0x0800
#define BUTTON_TRIGGER_3 0x0200
#define BUTTON_SELECT 0x0040
#define BUTTON_START 0x0080
#define DPAD_UP 0x1000
#define DPAD_DOWN 0x4000
#define DPAD_RIGHT 0x8000
#define DPAD_LEFT 0x2000
Obviously after you have NEGATED the 2 bytes
Numbski:
Thanks for the clarification smog. :)
I've been struggling through FreeBSD's header files trying to figure out what mechanism it uses to read HID input. No luck so far. What I was hoping to do was use libusb to handle detection, attach, and detach, and use most of the existing code to handle reading from the gun. Then use ifdef statements to hand it off to each OS based on what headers and functions they use to get HID input.
Doesn't help that I really am not a programmer though. :\
Smog:
Don't know much about drivers under linux (even if I usually work with C/UNIX). However I implemented an HID minidriver (provides information to the upper GENERIC HID native driver) for the gun in windows ... if you need any help on the HID interface definition you're welcome.
Numbski:
That would help a TON. I'm wading through whitepapers in what little free time I have and I'm having a hard time making heads or tails of it. :\
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version