Reformat code (tabs -> spaces)
This commit is contained in:
@@ -69,22 +69,22 @@ struct g29_keymap {
|
|||||||
|
|
||||||
static const struct g29_keymap media_mode_keymap[] = {
|
static const struct g29_keymap media_mode_keymap[] = {
|
||||||
/* Red rotary = volume */
|
/* Red rotary = volume */
|
||||||
{ G29_BTN_RED_CW, KEY_VOLUMEUP },
|
{G29_BTN_RED_CW, KEY_VOLUMEUP},
|
||||||
{ G29_BTN_RED_CCW, KEY_VOLUMEDOWN },
|
{G29_BTN_RED_CCW, KEY_VOLUMEDOWN},
|
||||||
|
|
||||||
/* Return = play/pause */
|
/* Return = play/pause */
|
||||||
{ G29_BTN_RETURN, KEY_PLAYPAUSE },
|
{G29_BTN_RETURN, KEY_PLAYPAUSE},
|
||||||
|
|
||||||
/* Plus/Minus = next/prev */
|
/* Plus/Minus = next/prev */
|
||||||
{ G29_BTN_R1, KEY_NEXTSONG },
|
{G29_BTN_R1, KEY_NEXTSONG},
|
||||||
{ G29_BTN_L1, KEY_PREVIOUSSONG },
|
{G29_BTN_L1, KEY_PREVIOUSSONG},
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct g29_keymap mouse_mode_keymap[] = {
|
static const struct g29_keymap mouse_mode_keymap[] = {
|
||||||
{ G29_BTN_X, BTN_LEFT },
|
{G29_BTN_X, BTN_LEFT},
|
||||||
{ G29_BTN_CIRCLE, BTN_RIGHT },
|
{G29_BTN_CIRCLE, BTN_RIGHT},
|
||||||
{ G29_BTN_TRIANGLE, BTN_MIDDLE },
|
{G29_BTN_TRIANGLE, BTN_MIDDLE},
|
||||||
{ G29_BTN_SQUARE, BTN_SIDE },
|
{G29_BTN_SQUARE, BTN_SIDE},
|
||||||
};
|
};
|
||||||
|
|
||||||
struct g29_dev {
|
struct g29_dev {
|
||||||
@@ -114,7 +114,6 @@ struct g29_dev {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void g29_switch_mode(struct g29_dev *g29, enum g29_mode new_mode) {
|
static void g29_switch_mode(struct g29_dev *g29, enum g29_mode new_mode) {
|
||||||
if (g29->current_mode == new_mode)
|
if (g29->current_mode == new_mode)
|
||||||
return;
|
return;
|
||||||
@@ -159,7 +158,7 @@ static int calc_adjusted_steering_distance(int distance) {
|
|||||||
return distance;
|
return distance;
|
||||||
}
|
}
|
||||||
if (steer_curve == 200) {
|
if (steer_curve == 200) {
|
||||||
return(distance * distance) / WHEEL_MAX_DIST;
|
return (distance * distance) / WHEEL_MAX_DIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Generic power curve using normalized values (0-1000 range for precision)
|
/* Generic power curve using normalized values (0-1000 range for precision)
|
||||||
@@ -241,10 +240,10 @@ static void mouse_mode_timer_fn(struct timer_list *t) {
|
|||||||
* For angle_normalized in [-1000, 1000] representing [-π, +π]:
|
* For angle_normalized in [-1000, 1000] representing [-π, +π]:
|
||||||
* This gives us full reverse when fully steered
|
* This gives us full reverse when fully steered
|
||||||
*/
|
*/
|
||||||
long angle_cubed = ((long)angle_normalized * angle_normalized * angle_normalized) / 1000000;
|
long angle_cubed = ((long) angle_normalized * angle_normalized * angle_normalized) / 1000000;
|
||||||
int sin_approx = (angle_normalized * 1000 - angle_cubed / 6) / 1000;
|
int sin_approx = (angle_normalized * 1000 - angle_cubed / 6) / 1000;
|
||||||
|
|
||||||
long angle_squared = ((long)angle_normalized * angle_normalized) / 1000;
|
long angle_squared = ((long) angle_normalized * angle_normalized) / 1000;
|
||||||
long angle_fourth = (angle_squared * angle_squared) / 1000;
|
long angle_fourth = (angle_squared * angle_squared) / 1000;
|
||||||
int cos_approx = 1000 - angle_squared / 2 + angle_fourth / 24;
|
int cos_approx = 1000 - angle_squared / 2 + angle_fourth / 24;
|
||||||
|
|
||||||
@@ -266,6 +265,7 @@ static void mouse_mode_timer_fn(struct timer_list *t) {
|
|||||||
if (g29->current_mode == G29_MODE_MOUSE)
|
if (g29->current_mode == G29_MODE_MOUSE)
|
||||||
mod_timer(&g29->mouse_timer, jiffies + msecs_to_jiffies(10));
|
mod_timer(&g29->mouse_timer, jiffies + msecs_to_jiffies(10));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wasd_mode_timer_fn(struct timer_list *t) {
|
static void wasd_mode_timer_fn(struct timer_list *t) {
|
||||||
struct g29_dev *g29 = timer_container_of(g29, t, steer_timer);
|
struct g29_dev *g29 = timer_container_of(g29, t, steer_timer);
|
||||||
|
|
||||||
@@ -533,20 +533,20 @@ static int g29_probe(struct usb_interface *intf, const struct usb_device_id *id)
|
|||||||
__set_bit(EV_KEY, input->evbit);
|
__set_bit(EV_KEY, input->evbit);
|
||||||
__set_bit(EV_REL, input->evbit);
|
__set_bit(EV_REL, input->evbit);
|
||||||
|
|
||||||
/* Media mode keys */
|
// Media mode keys
|
||||||
input_set_capability(input, EV_KEY, KEY_VOLUMEUP);
|
input_set_capability(input, EV_KEY, KEY_VOLUMEUP);
|
||||||
input_set_capability(input, EV_KEY, KEY_VOLUMEDOWN);
|
input_set_capability(input, EV_KEY, KEY_VOLUMEDOWN);
|
||||||
input_set_capability(input, EV_KEY, KEY_PLAYPAUSE);
|
input_set_capability(input, EV_KEY, KEY_PLAYPAUSE);
|
||||||
input_set_capability(input, EV_KEY, KEY_NEXTSONG);
|
input_set_capability(input, EV_KEY, KEY_NEXTSONG);
|
||||||
input_set_capability(input, EV_KEY, KEY_PREVIOUSSONG);
|
input_set_capability(input, EV_KEY, KEY_PREVIOUSSONG);
|
||||||
|
|
||||||
/* WASD mode keys */
|
// WASD mode keys
|
||||||
input_set_capability(input, EV_KEY, KEY_W);
|
input_set_capability(input, EV_KEY, KEY_W);
|
||||||
input_set_capability(input, EV_KEY, KEY_A);
|
input_set_capability(input, EV_KEY, KEY_A);
|
||||||
input_set_capability(input, EV_KEY, KEY_S);
|
input_set_capability(input, EV_KEY, KEY_S);
|
||||||
input_set_capability(input, EV_KEY, KEY_D);
|
input_set_capability(input, EV_KEY, KEY_D);
|
||||||
|
|
||||||
/* Mouse mode capabilities */
|
// Mouse mode capabilities
|
||||||
input_set_capability(input, EV_KEY, BTN_LEFT);
|
input_set_capability(input, EV_KEY, BTN_LEFT);
|
||||||
input_set_capability(input, EV_KEY, BTN_RIGHT);
|
input_set_capability(input, EV_KEY, BTN_RIGHT);
|
||||||
input_set_capability(input, EV_KEY, BTN_MIDDLE);
|
input_set_capability(input, EV_KEY, BTN_MIDDLE);
|
||||||
@@ -600,9 +600,9 @@ static void g29_disconnect(struct usb_interface *intf) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const struct usb_device_id g29_id_table[] = {
|
static const struct usb_device_id g29_id_table[] = {
|
||||||
{ USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G29) },
|
{USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G29)},
|
||||||
{ USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G29_ALT) },
|
{USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G29_ALT)},
|
||||||
{ }
|
{}
|
||||||
};
|
};
|
||||||
MODULE_DEVICE_TABLE(usb, g29_id_table);
|
MODULE_DEVICE_TABLE(usb, g29_id_table);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user