Lines Matching full:settings

92 static void kone_set_settings_checksum(struct kone_settings *settings)  in kone_set_settings_checksum()  argument
95 unsigned char *address = (unsigned char *)settings; in kone_set_settings_checksum()
100 settings->checksum = cpu_to_le16(checksum); in kone_set_settings_checksum()
141 * Reads settings from mouse and stores it in @buf
153 * Writes settings from @buf to mouse
158 struct kone_settings const *settings) in kone_set_settings() argument
163 settings, sizeof(struct kone_settings)); in kone_set_settings()
276 memcpy(buf, ((char const *)&kone->settings) + off, count); in kone_sysfs_read_settings()
283 * Writing settings automatically activates startup_profile.
294 struct kone_settings *settings = (struct kone_settings *)buf; in kone_sysfs_write_settings() local
301 difference = memcmp(settings, &kone->settings, in kone_sysfs_write_settings()
304 if (settings->startup_profile < 1 || in kone_sysfs_write_settings()
305 settings->startup_profile > 5) { in kone_sysfs_write_settings()
310 retval = kone_set_settings(usb_dev, settings); in kone_sysfs_write_settings()
314 old_profile = kone->settings.startup_profile; in kone_sysfs_write_settings()
315 memcpy(&kone->settings, settings, sizeof(struct kone_settings)); in kone_sysfs_write_settings()
317 kone_profile_activated(kone, kone->settings.startup_profile); in kone_sysfs_write_settings()
319 if (kone->settings.startup_profile != old_profile) in kone_sysfs_write_settings()
320 kone_profile_report(kone, kone->settings.startup_profile); in kone_sysfs_write_settings()
330 static BIN_ATTR(settings, 0660, kone_sysfs_read_settings,
454 return sysfs_emit(buf, "%d\n", kone->settings.tcu); in kone_sysfs_show_tcu()
466 * Calibrating the tcu is the only action that changes settings data inside the
509 * Reading settings too early will result in invalid data. in kone_sysfs_set_tcu()
516 /* calibration changes values in settings, so reread */ in kone_sysfs_set_tcu()
517 retval = kone_get_settings(usb_dev, &kone->settings); in kone_sysfs_set_tcu()
521 /* only write settings back if activation state is different */ in kone_sysfs_set_tcu()
522 if (kone->settings.tcu != state) { in kone_sysfs_set_tcu()
523 kone->settings.tcu = state; in kone_sysfs_set_tcu()
524 kone_set_settings_checksum(&kone->settings); in kone_sysfs_set_tcu()
526 retval = kone_set_settings(usb_dev, &kone->settings); in kone_sysfs_set_tcu()
530 * try to reread valid settings into buffer overwriting in kone_sysfs_set_tcu()
533 retval = kone_get_settings(usb_dev, &kone->settings); in kone_sysfs_set_tcu()
539 kone_profile_activated(kone, kone->settings.startup_profile); in kone_sysfs_set_tcu()
544 dev_err(&usb_dev->dev, "couldn't read settings\n"); in kone_sysfs_set_tcu()
556 return sysfs_emit(buf, "%d\n", kone->settings.startup_profile); in kone_sysfs_show_startup_profile()
580 kone->settings.startup_profile = new_startup_profile; in kone_sysfs_set_startup_profile()
581 kone_set_settings_checksum(&kone->settings); in kone_sysfs_set_startup_profile()
583 retval = kone_set_settings(usb_dev, &kone->settings); in kone_sysfs_set_startup_profile()
601 * Read actual dpi settings.
677 retval = kone_get_settings(usb_dev, &kone->settings); in kone_init_kone_device_struct()
685 kone_profile_activated(kone, kone->settings.startup_profile); in kone_init_kone_device_struct()