Set led status on connect
This commit is contained in:
parent
5fa8ee1126
commit
1d320fa02a
7 changed files with 64 additions and 19 deletions
11
NEWS
11
NEWS
|
@ -1,15 +1,19 @@
|
|||
xboxdrv 0.4.3 - (??/Jan/2009)
|
||||
=============================
|
||||
* support for X11 keysym in --ui-buttonmap
|
||||
|
||||
* added support for X11 keysym in --ui-buttonmap
|
||||
* added --ui-clear and void mappings to unmap buttons and axis
|
||||
|
||||
|
||||
xboxdrv 0.4.2 - (11/Jan/2009)
|
||||
============================
|
||||
=============================
|
||||
|
||||
* fixed --dpad-only
|
||||
|
||||
|
||||
xboxdrv 0.4.1 - (08/Jan/2009)
|
||||
============================
|
||||
=============================
|
||||
|
||||
* workaround for KEY_MEDIA_REPEAT
|
||||
|
||||
|
||||
|
@ -52,6 +56,7 @@ xboxdrv 0.2 - (03/May/2008)
|
|||
|
||||
xboxdrv 0.1 - (13/Apr/2008)
|
||||
===========================
|
||||
|
||||
* initial release
|
||||
|
||||
# EOF #
|
||||
|
|
16
README
16
README
|
@ -251,7 +251,8 @@ expect in case you use a keymap that is different then your keyboard
|
|||
|
||||
A full list of X11 keysyms is available at
|
||||
/usr/include/X11/keysymdef.h, note that you can only use those that
|
||||
are reachable by your current.
|
||||
are reachable by your current keymap. Keysyms that are reachable via
|
||||
multiple keycodes might break the mapping from keysym to evdev code.
|
||||
|
||||
When you try to let a gamepad key send a keyboard event you might run
|
||||
into trouble with Xorg, for possible fixes see the section further down.
|
||||
|
@ -441,10 +442,10 @@ keyboard, like Flash games or games that don't support a joystick, you
|
|||
have to adjust the keybindings to fit the game:
|
||||
|
||||
% ./xboxdrv \
|
||||
--ui-clear \
|
||||
--dpad-as-button \
|
||||
--ui-buttonmap a=XK_a,b=XK_b,x=XK_x,y=XK_y \
|
||||
--ui-buttonmap dl=XK_Left,dr=XK_Right,du=XK_Up,dd=XK_Down \
|
||||
--deadzone 16000
|
||||
|
||||
|
||||
Sauerbraten
|
||||
|
@ -619,7 +620,18 @@ itself works with:
|
|||
You have to sync the controller befor it can be used, restart of the
|
||||
driver isn't needed and the driver should let you now when it recieves
|
||||
a connection after you sync the controller.
|
||||
|
||||
[[ Force Feedback ]]
|
||||
--------------------
|
||||
|
||||
Force feedback is provided via the standard kernel ff interface:
|
||||
|
||||
|
||||
[[ Known bugs ]]
|
||||
----------------
|
||||
|
||||
X11 keysyms might not work correctly in '--ui-buttonmap a=XK_Down'
|
||||
when Down is mapped to multiple keycodes in the keymap.
|
||||
|
||||
|
||||
# EOF #
|
||||
|
|
16
TODO
16
TODO
|
@ -1,4 +1,5 @@
|
|||
- Test cases:
|
||||
Pre Release Testing:
|
||||
====================
|
||||
|
||||
* default, test all axis and buttons
|
||||
* --dpad-only check that X/Y act properly
|
||||
|
@ -8,8 +9,17 @@
|
|||
Stuff to do before 0.5 release:
|
||||
===============================
|
||||
|
||||
* add a way to ignore axis or button
|
||||
* add a way to not create a joystick device
|
||||
* print unused dummy bytes
|
||||
|
||||
* add a way to not create a joystick/event device
|
||||
|
||||
* report more precisly what devices got created, include device name (HAL has that information)
|
||||
|
||||
* display ui-buttonmap in the configuration overview, tricky since we
|
||||
don't differ between default bindings and user created ones, also
|
||||
which bindings get used depends on other configuration options
|
||||
|
||||
* set proper idVendor/idProduct in uinput
|
||||
|
||||
* figure out what jscal does and if it can break stuff
|
||||
1) jscal uses the joystick interface, not the event interface
|
||||
|
|
|
@ -585,6 +585,7 @@ public:
|
|||
class Keysym2Keycode
|
||||
{
|
||||
public:
|
||||
// Map KeySym to kernel keycode
|
||||
std::map<KeySym, int> mapping;
|
||||
|
||||
Keysym2Keycode()
|
||||
|
@ -617,7 +618,14 @@ public:
|
|||
for(int i = 0; i < num_keycodes; ++i)
|
||||
{
|
||||
if (keymap[i*keysyms_per_keycode] != NoSymbol)
|
||||
mapping[keymap[i*keysyms_per_keycode]] = i;
|
||||
{
|
||||
KeySym keysym = keymap[i*keysyms_per_keycode];
|
||||
// FIXME: Duplicate entries confuse the conversion
|
||||
// std::map<KeySym, int>::iterator it = mapping.find(keysym);
|
||||
// if (it != mapping.end())
|
||||
// std::cout << "Duplicate keycode: " << i << std::endl;
|
||||
mapping[keysym] = i;
|
||||
}
|
||||
}
|
||||
|
||||
XFree(keymap);
|
||||
|
@ -629,16 +637,24 @@ int xkeysym2keycode(const std::string& name)
|
|||
static Keysym2Keycode sym2code;
|
||||
|
||||
KeySym keysym = XStringToKeysym(name.substr(3).c_str());
|
||||
|
||||
if (keysym == NoSymbol)
|
||||
{
|
||||
throw std::runtime_error("xkeysym2keycode: Couldn't convert name '" + name + "' to xkeysym");
|
||||
}
|
||||
|
||||
std::map<KeySym, int>::iterator i = sym2code.mapping.find(keysym);
|
||||
std::map<KeySym, int>::iterator i = sym2code.mapping.find(keysym);
|
||||
if (i == sym2code.mapping.end())
|
||||
throw std::runtime_error("xkeysym2keycode: Couldn't convert xkeysym '" + name + "' to evdev keycode");
|
||||
{
|
||||
throw std::runtime_error("xkeysym2keycode: Couldn't convert xkeysym '" + name + "' to evdev keycode");
|
||||
}
|
||||
else
|
||||
return i->second;
|
||||
{
|
||||
if (0)
|
||||
std::cout << name << " -> " << keysym << " -> " << XKeysymToString(keysym)
|
||||
<< " -> " << btn2str(i->second) << "(" << i->second << ")" << std::endl;
|
||||
return i->second;
|
||||
}
|
||||
}
|
||||
|
||||
bool str2event(const std::string& name, int& type, int& code)
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
Xbox360WirelessController::Xbox360WirelessController(struct usb_device* dev,
|
||||
int controller_id)
|
||||
: led_status(0)
|
||||
{
|
||||
assert(controller_id >= 0 && controller_id < 4);
|
||||
|
||||
|
@ -74,6 +75,7 @@ Xbox360WirelessController::set_rumble(uint8_t left, uint8_t right)
|
|||
void
|
||||
Xbox360WirelessController::set_led(uint8_t status)
|
||||
{
|
||||
led_status = status;
|
||||
// +--- Why not just status?
|
||||
// v
|
||||
char ledcmd[] = { 0x00, 0x00, 0x08, 0x40 + (status % 0x0e), 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||
|
@ -105,6 +107,7 @@ Xbox360WirelessController::read(XboxGenericMsg& msg, bool verbose, int timeout)
|
|||
else if (data[1] == 0x80)
|
||||
{
|
||||
std::cout << "Connection status: controller connected" << std::endl;
|
||||
set_led(led_status);
|
||||
}
|
||||
else if (data[1] == 0x40)
|
||||
{
|
||||
|
@ -113,6 +116,7 @@ Xbox360WirelessController::read(XboxGenericMsg& msg, bool verbose, int timeout)
|
|||
else if (data[1] == 0xc0)
|
||||
{
|
||||
std::cout << "Connection status: controller and headset connected" << std::endl;
|
||||
set_led(led_status);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -33,6 +33,7 @@ private:
|
|||
int interface;
|
||||
int battery_status;
|
||||
std::string serial;
|
||||
int led_status;
|
||||
|
||||
public:
|
||||
Xbox360WirelessController(struct usb_device* dev,
|
||||
|
|
|
@ -445,7 +445,7 @@ void print_led_help()
|
|||
void print_version()
|
||||
{
|
||||
std::cout
|
||||
<< "xboxdrv 0.4.2\n"
|
||||
<< "xboxdrv 0.4.3\n"
|
||||
<< "Copyright (C) 2008 Ingo Ruhnke <grumbel@gmx.de>\n"
|
||||
<< "License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n"
|
||||
<< "This is free software: you are free to change and redistribute it.\n"
|
||||
|
@ -874,6 +874,9 @@ void print_info(struct usb_device* dev,
|
|||
std::cout << "LED Status: " << "auto" << std::endl;
|
||||
else
|
||||
std::cout << "LED Status: " << opts.led << std::endl;
|
||||
|
||||
std::cout << "Square Axis: " << ((opts.square_axis) ? "yes" : "no") << std::endl;
|
||||
|
||||
std::cout << "ButtonMap: ";
|
||||
if (opts.button_map.empty())
|
||||
{
|
||||
|
@ -905,12 +908,6 @@ void print_info(struct usb_device* dev,
|
|||
std::cout << std::endl;
|
||||
}
|
||||
|
||||
std::cout << "Square Axis: ";
|
||||
if (opts.square_axis)
|
||||
std::cout << "yes" << std::endl;
|
||||
else
|
||||
std::cout << "no" << std::endl;
|
||||
|
||||
std::cout << "RelativeAxisMap: ";
|
||||
if (opts.relative_axis_map.empty())
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue