Lines Matching refs:settings

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