Lines Matching refs:settings

95 static void kone_set_settings_checksum(struct kone_settings *settings)
98 unsigned char *address = (unsigned char *)settings;
103 settings->checksum = cpu_to_le16(checksum);
144 * Reads settings from mouse and stores it in @buf
156 * Writes settings from @buf to mouse
161 struct kone_settings const *settings)
166 settings, sizeof(struct kone_settings));
279 memcpy(buf, ((char const *)&kone->settings) + off, count);
286 * Writing settings automatically activates startup_profile.
297 struct kone_settings *settings = (struct kone_settings *)buf;
304 difference = memcmp(settings, &kone->settings,
307 if (settings->startup_profile < 1 ||
308 settings->startup_profile > 5) {
313 retval = kone_set_settings(usb_dev, settings);
317 old_profile = kone->settings.startup_profile;
318 memcpy(&kone->settings, settings, sizeof(struct kone_settings));
320 kone_profile_activated(kone, kone->settings.startup_profile);
322 if (kone->settings.startup_profile != old_profile)
323 kone_profile_report(kone, kone->settings.startup_profile);
333 static BIN_ATTR(settings, 0660, kone_sysfs_read_settings,
457 return snprintf(buf, PAGE_SIZE, "%d\n", kone->settings.tcu);
469 * Calibrating the tcu is the only action that changes settings data inside the
512 * Reading settings too early will result in invalid data.
519 /* calibration changes values in settings, so reread */
520 retval = kone_get_settings(usb_dev, &kone->settings);
524 /* only write settings back if activation state is different */
525 if (kone->settings.tcu != state) {
526 kone->settings.tcu = state;
527 kone_set_settings_checksum(&kone->settings);
529 retval = kone_set_settings(usb_dev, &kone->settings);
533 * try to reread valid settings into buffer overwriting
536 retval = kone_get_settings(usb_dev, &kone->settings);
542 kone_profile_activated(kone, kone->settings.startup_profile);
547 dev_err(&usb_dev->dev, "couldn't read settings\n");
559 return snprintf(buf, PAGE_SIZE, "%d\n", kone->settings.startup_profile);
583 kone->settings.startup_profile = new_startup_profile;
584 kone_set_settings_checksum(&kone->settings);
586 retval = kone_set_settings(usb_dev, &kone->settings);
604 * Read actual dpi settings.
674 retval = kone_get_settings(usb_dev, &kone->settings);
682 kone_profile_activated(kone, kone->settings.startup_profile);