Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for issue #18. #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions wminput/conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ int conf_axis(struct conf *conf, int axis, __u16 axis_type, __u16 action,
case CONF_NC_AXIS_STICK_Y:
conf->rpt_mode_flags |= CWIID_RPT_NUNCHUK;
if (axis_type == EV_ABS) {
conf->dev.absmax[action] = 0xFF;
conf->dev.absmin[action] = 0;
conf->dev.absmax[action] = 0xFF/2.0;
conf->dev.absmin[action] = -0xFF/2.0;
conf->dev.absfuzz[action] = 0;
conf->dev.absflat[action] = 0;
}
Expand All @@ -179,8 +179,8 @@ int conf_axis(struct conf *conf, int axis, __u16 axis_type, __u16 action,
case CONF_CC_AXIS_L_STICK_Y:
conf->rpt_mode_flags |= CWIID_RPT_CLASSIC;
if (axis_type == EV_ABS) {
conf->dev.absmax[action] = CWIID_CLASSIC_L_STICK_MAX;
conf->dev.absmin[action] = 0;
conf->dev.absmax[action] = CWIID_CLASSIC_L_STICK_MAX/2.0;
conf->dev.absmin[action] = -CWIID_CLASSIC_L_STICK_MAX/2.0;
conf->dev.absfuzz[action] = 0;
conf->dev.absflat[action] = 0;
}
Expand All @@ -189,8 +189,8 @@ int conf_axis(struct conf *conf, int axis, __u16 axis_type, __u16 action,
case CONF_CC_AXIS_R_STICK_Y:
conf->rpt_mode_flags |= CWIID_RPT_CLASSIC;
if (axis_type == EV_ABS) {
conf->dev.absmax[action] = CWIID_CLASSIC_R_STICK_MAX;
conf->dev.absmin[action] = 0;
conf->dev.absmax[action] = CWIID_CLASSIC_R_STICK_MAX/2.0;
conf->dev.absmin[action] = -CWIID_CLASSIC_R_STICK_MAX/2.0;
conf->dev.absfuzz[action] = 0;
conf->dev.absflat[action] = 0;
}
Expand Down
24 changes: 12 additions & 12 deletions wminput/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -510,19 +510,19 @@ void process_nunchuk_mesg(struct cwiid_nunchuk_mesg *mesg)

/* Nunchuk.Stick.X */
if (conf.amap[CONF_NC_AXIS_STICK_X].active) {
axis_value = mesg->stick[CWIID_X];
axis_value = mesg->stick[CWIID_X]-0xFF/2.0;
if (conf.amap[CONF_NC_AXIS_STICK_X].flags & CONF_INVERT) {
axis_value = 0xFF - axis_value;
axis_value = -axis_value;
}
send_event(&conf, conf.amap[CONF_NC_AXIS_STICK_X].axis_type,
conf.amap[CONF_NC_AXIS_STICK_X].action, axis_value);
}

/* Nunchuk.Stick.Y */
if (conf.amap[CONF_NC_AXIS_STICK_Y].active) {
axis_value = mesg->stick[CWIID_Y];
axis_value = mesg->stick[CWIID_Y]-0xFF/2.0;
if (conf.amap[CONF_NC_AXIS_STICK_Y].flags & CONF_INVERT) {
axis_value = 0xFF - axis_value;
axis_value = axis_value;
}
send_event(&conf, conf.amap[CONF_NC_AXIS_STICK_Y].axis_type,
conf.amap[CONF_NC_AXIS_STICK_Y].action, axis_value);
Expand Down Expand Up @@ -585,39 +585,39 @@ void process_classic_mesg(struct cwiid_classic_mesg *mesg)

/* Classic.LStick.X */
if (conf.amap[CONF_CC_AXIS_L_STICK_X].active) {
axis_value = mesg->l_stick[CWIID_X];
axis_value = mesg->l_stick[CWIID_X]-CWIID_CLASSIC_L_STICK_MAX/2.0;
if (conf.amap[CONF_CC_AXIS_L_STICK_X].flags & CONF_INVERT) {
axis_value = CWIID_CLASSIC_L_STICK_MAX - axis_value;
axis_value = -axis_value;
}
send_event(&conf, conf.amap[CONF_CC_AXIS_L_STICK_X].axis_type,
conf.amap[CONF_CC_AXIS_L_STICK_X].action, axis_value);
}

/* Classic.LStick.Y */
if (conf.amap[CONF_CC_AXIS_L_STICK_Y].active) {
axis_value = mesg->l_stick[CWIID_Y];
axis_value = mesg->l_stick[CWIID_Y]-CWIID_CLASSIC_L_STICK_MAX/2.0;
if (conf.amap[CONF_CC_AXIS_L_STICK_Y].flags & CONF_INVERT) {
axis_value = CWIID_CLASSIC_L_STICK_MAX - axis_value;
axis_value = -axis_value;
}
send_event(&conf, conf.amap[CONF_CC_AXIS_L_STICK_Y].axis_type,
conf.amap[CONF_CC_AXIS_L_STICK_Y].action, axis_value);
}

/* Classic.RStick.X */
if (conf.amap[CONF_CC_AXIS_R_STICK_X].active) {
axis_value = mesg->r_stick[CWIID_X];
axis_value = mesg->r_stick[CWIID_X]-CWIID_CLASSIC_R_STICK_MAX/2.0;
if (conf.amap[CONF_CC_AXIS_R_STICK_X].flags & CONF_INVERT) {
axis_value = CWIID_CLASSIC_R_STICK_MAX - axis_value;
axis_value = -axis_value;
}
send_event(&conf, conf.amap[CONF_CC_AXIS_R_STICK_X].axis_type,
conf.amap[CONF_CC_AXIS_R_STICK_X].action, axis_value);
}

/* Classic.RStick.Y */
if (conf.amap[CONF_CC_AXIS_R_STICK_Y].active) {
axis_value = mesg->r_stick[CWIID_Y];
axis_value = mesg->r_stick[CWIID_Y]-CWIID_CLASSIC_R_STICK_MAX/2.0;
if (conf.amap[CONF_CC_AXIS_R_STICK_Y].flags & CONF_INVERT) {
axis_value = CWIID_CLASSIC_R_STICK_MAX - axis_value;
axis_value = -axis_value;
}
send_event(&conf, conf.amap[CONF_CC_AXIS_R_STICK_Y].axis_type,
conf.amap[CONF_CC_AXIS_R_STICK_Y].action, axis_value);
Expand Down