Some more chatpad work

This commit is contained in:
Ingo Ruhnke 2011-01-02 19:12:32 +01:00
parent 340d1d325c
commit 7006682250
6 changed files with 107 additions and 16 deletions

View file

@ -35,8 +35,12 @@ Other parts of the code are inspired or based on cwiid:
* L. Donnie Smith <wiimote@abstrakraft.org>
Chatpad USB Protocol Traces:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Chatpad USB Reverse Engineering:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
* Jani Virta <jani.virta@iqit.fi>
* Andy Kirkham
* dwomac
* GAFBlizzard
# EOF #

8
NEWS
View file

@ -1,3 +1,11 @@
xboxdrv 0.6.3 - (??/Jan/2011)
=============================
* chatpad support, enable with --chatpad (special thanks to Jani
Virta, Andy Kirkham, dwomac and GAFBlizzard who helped make it
possible)
xboxdrv 0.6.2 - (31/Dec/2010)
=============================

View file

@ -256,6 +256,46 @@ usb_control_msg()'s
Sending "0x41 0x0 0x1f 0x02" gives a reply of "0x08, 0x03, 0x01"
(chatpad) or "0x08, 0x03, 0x03" (chatpad + headset)
Data from Chatpad
=================
0xf0 0x04
0x00 MODIFIER SCAN1 SCAN2 0x00
,- active LEDs
/ ,----,---- clock, counts up to 0x0f then rolls to zero
0xf0 0x04 LEDSTATUS 0x0e 0x0e
0x00 0x00 0x34 0x00 0x00 <- always zero
| | `- scan1 `scan2
\ `--- modifier bit field
`--- input event
LED:
10111001
<backlight> <zero> <shift> <orange> <green> 0 0 <people>
LED_STATUS_PEOPLE = (1<<0)
LED_STATUS_SHIFT = (1<<5)
LED_STATUS_ORANGE = (1<<4)
LED_STATUS_GREEN = (1<<3)
LED_STATUS_BACKLIGHT = (1<<7)
0xa0 - shift
0x88 - green
0x81 - people
0x90 - orange
0x91 - people+orange
0x98 - orange+green
0xb0 - shift+orange
0xb9 - shift+orange+green+shift
Chatpad init:
Hardware version 1.10, uses 0x01 0x02 for init.
Hardware version 1.14, uses 0x09 0x00 for init.
Xbox360 Guitar
==============

29
TODO
View file

@ -17,16 +17,37 @@ Ubuntu Package:
===============
$ cd ../debian/
$ git-import-orig -u 0.6.1 ~/projects/xboxdrv/htdocs/xboxdrv-linux-0.6.1.tar.bz2
$ dch -v "0.6.1" "New Ubuntu release"
$ git-import-orig -u 0.6.3 ~/projects/xboxdrv/htdocs/xboxdrv-linux-0.6.3.tar.bz2
$ dch -v "0.6.3" "New xboxdrv release"
$ git-buildpackage --git-tag --git-builder="debuild -S"
$ sudo pbuilder --build xboxdrv_0.6.1.dsc
$ dput my-ppa xboxdrv_0.6.1_source.changes
$ sudo pbuilder --build xboxdrv_0.6.3.dsc
$ dput my-ppa xboxdrv_0.6.3_source.changes
Stuff to do before 0.6.4 release:
=================================
* integrate filters into --buttonmap and --axismap:
--buttonmap X^toggle:autofire=B
--axismap Y1^relative
main purpose: allow to make shift a toggle button
* bug: when shifting the last axis state sticks even when they key was released
Figure out a way to load custom keymaps:
* http://madduck.net/docs/extending-xkb/
* http://stackoverflow.com/questions/1557689/keyboard-remapping-with-more-modifiers
* http://tldp.org/HOWTO/Keyboard-and-Console-HOWTO-15.html
Stuff to do before 0.6.x release:
=================================
http://www.mp3car.com/vbulletin/input-devices/108554-xbox360-chatpad-awsome-backlit-mini-keyboard-16.html#post1256444
* change default axis/button map depending on controller type (tricky as
type is only really known after the axis/buttonmap as already been
build):

View file

@ -183,9 +183,7 @@ Chatpad::read_thread()
}
else
{
if (false)
{
if (!(data[0] == 0xf0 && data[1] == 0x04)) // ignore timing messages
if (true)
{
std::cout << "read: " << len << "/5: data: " << std::flush;
for(int i = 0; i < len; ++i)
@ -194,7 +192,6 @@ Chatpad::read_thread()
}
std::cout << std::endl;
}
}
if (data[0] == 0x00)
{
@ -231,6 +228,11 @@ Chatpad::process(const ChatpadKeyMsg& msg)
{
if (m_state[i])
{
if (i == CHATPAD_KEY_1)
{
usb_control_msg(m_handle, 0x41, 0x00, 0x0004, 0x0002, NULL, 0, 0);
}
if (i == CHATPAD_MOD_PEOPLE)
{
set_led(CHATPAD_LED_PEOPLE, !get_led(CHATPAD_LED_PEOPLE));
@ -297,9 +299,17 @@ Chatpad::send_init()
// chatpad already ready
}
else
{
if (true /* old_xbox360 pad */)
{
buf[0] = 0x01;
buf[1] = 0x02;
}
else
{
buf[0] = 0x09;
buf[1] = 0x00;
}
ret = usb_control_msg(m_handle, 0x40, 0xa1, 0x0000, 0xe416, buf, 2, 0); // (send 2 bytes, data must be 0x09 0x00)
std::cout << "ret: " << ret << std::endl;

View file

@ -84,6 +84,14 @@ enum {
CHATPAD_LED_BACKLIGHT = 1<<4
};
enum {
CHATPAD_LED_STATUS_PEOPLE = (1<<0),
CHATPAD_LED_STATUS_SHIFT = (1<<5),
CHATPAD_LED_STATUS_ORANGE = (1<<4),
CHATPAD_LED_STATUS_GREEN = (1<<3),
CHATPAD_LED_STATUS_BACKLIGHT = (1<<7)
};
class Chatpad
{
private: