Skip to content

Commit

Permalink
fix start-solo, fixes #23
Browse files Browse the repository at this point in the history
  • Loading branch information
gotzl committed Jul 13, 2024
1 parent 8ebc102 commit 070ac02
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions hid-ftec.c
Original file line number Diff line number Diff line change
Expand Up @@ -522,26 +522,25 @@ static int ftec_client_ll_raw_request(struct hid_device *hdev,
effect->id = 0;
// FIXME: also unload?
break;
}

if (params->op == 0x2) {
// stop all other effects
struct ff_effect *other_effect;
for (size_t i = 0; i < ARRAY_SIZE(drv_data->client.effects); ++i) {
other_effect = &drv_data->client.effects[i];
if (other_effect->id > 0 && other_effect != effect) {
(void)ff->playback(inputdev, other_effect->id, 0);
other_effect->id = 0;
// FIXME: also unload?
} else {
if (params->op == 0x2) {
// stop all other effects
struct ff_effect *other_effect;
for (size_t i = 0; i < ARRAY_SIZE(drv_data->client.effects); ++i) {
other_effect = &drv_data->client.effects[i];
if (other_effect->id > 0 && other_effect != effect) {
(void)ff->playback(inputdev, other_effect->id, 0);
other_effect->id = 0;
// FIXME: also unload?
}
}
}

}

if (params->op == 0x1) {
if (!effect->id) {
effect->id = params->id;
(void)ff->upload(inputdev, effect, NULL);
}
if (params->op == 0x1 || params->op == 0x2) {
if (!effect->id) {
effect->id = params->id;
(void)ff->upload(inputdev, effect, NULL);
}
}
}

Expand Down

0 comments on commit 070ac02

Please sign in to comment.