Lines Matching refs:accel
426 const __u8 *accel)
439 * X accel value. Bit 5 of the second buttons byte is the 2nd bit of Y
440 * accel value and bit 6 is the second bit of the Z value.
445 x = accel[2] << 2;
446 y = accel[3] << 2;
447 z = accel[4] << 2;
449 x |= (accel[0] >> 5) & 0x3;
450 y |= (accel[1] >> 4) & 0x2;
451 z |= (accel[1] >> 5) & 0x2;
453 input_report_abs(wdata->accel, ABS_RX, x - 0x200);
454 input_report_abs(wdata->accel, ABS_RY, y - 0x200);
455 input_report_abs(wdata->accel, ABS_RZ, z - 0x200);
456 input_sync(wdata->accel);
486 wdata->accel = input_allocate_device();
487 if (!wdata->accel)
490 input_set_drvdata(wdata->accel, wdata);
491 wdata->accel->open = wiimod_accel_open;
492 wdata->accel->close = wiimod_accel_close;
493 wdata->accel->dev.parent = &wdata->hdev->dev;
494 wdata->accel->id.bustype = wdata->hdev->bus;
495 wdata->accel->id.vendor = wdata->hdev->vendor;
496 wdata->accel->id.product = wdata->hdev->product;
497 wdata->accel->id.version = wdata->hdev->version;
498 wdata->accel->name = WIIMOTE_NAME " Accelerometer";
500 set_bit(EV_ABS, wdata->accel->evbit);
501 set_bit(ABS_RX, wdata->accel->absbit);
502 set_bit(ABS_RY, wdata->accel->absbit);
503 set_bit(ABS_RZ, wdata->accel->absbit);
504 input_set_abs_params(wdata->accel, ABS_RX, -500, 500, 2, 4);
505 input_set_abs_params(wdata->accel, ABS_RY, -500, 500, 2, 4);
506 input_set_abs_params(wdata->accel, ABS_RZ, -500, 500, 2, 4);
508 ret = input_register_device(wdata->accel);
517 input_free_device(wdata->accel);
518 wdata->accel = NULL;
525 if (!wdata->accel)
528 input_unregister_device(wdata->accel);
529 wdata->accel = NULL;