printk(KERN_INFO PREFIX "debounce_delay: %u\n", gpio_evmi->debounce_delay.tv.nsec);
}
+#if 0
if (gpio_evmi->debounce_delay.tv.nsec != 0) {
if (!(gpio_evmi->flags & GPIOKPF_DEBOUNCE)) {
printk(KERN_INFO PREFIX "Activating debounce\n");
gpio_evmi->flags &= ~GPIOKPF_DEBOUNCE;
}
}
+#endif
}
static ssize_t store_debounce_delay(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
sscanf(buf, "%ld", &delay);
set_debounce_delay(delay);
- return strnlen(buf, PAGE_SIZE);
+ return count;
}
static ssize_t show_settle_time(struct device *dev, struct device_attribute *attr, char *buf)
sscanf(buf, "%ld", &delay);
gpio_evmi->settle_time.tv.nsec = delay * NSEC_PER_USEC;
- return strnlen(buf, PAGE_SIZE);
+ return count;
}
static ssize_t show_poll_time(struct device *dev, struct device_attribute *attr, char *buf)
sscanf(buf, "%ld", &delay);
gpio_evmi->poll_time.tv.nsec = delay * NSEC_PER_MSEC;
- return strnlen(buf, PAGE_SIZE);
+ return count;
}
static ssize_t show_flags(struct device *dev, struct device_attribute *attr, char *buf)
return -ENODEV;
sscanf(buf, "0x%x", &flags);
+
+ printk(KERN_INFO PREFIX "flags: 0x%x\n", flags);
+
+ if (flags & GPIOKPF_DRIVE_INACTIVE)
+ return count;
+
gpio_evmi->flags = flags;
- return strnlen(buf, PAGE_SIZE);
+ return count;
+}
+
+static ssize_t show_debounce_flag(struct device *dev, struct device_attribute *attr, char *buf)
+{
+ if (!gpio_evmi)
+ return -ENODEV;
+
+ return snprintf(buf, PAGE_SIZE, "%u\n", (gpio_evmi->flags & GPIOKPF_DEBOUNCE) ? 1 : 0);
}
-static DEVICE_ATTR(debounce_delay, (S_IRUGO | S_IWUGO), &show_debounce_delay, store_debounce_delay);
-static DEVICE_ATTR(settle_time, (S_IRUGO | S_IWUGO), &show_settle_time, store_settle_time);
-static DEVICE_ATTR(poll_time, (S_IRUGO | S_IWUGO), &show_poll_time, store_poll_time);
-static DEVICE_ATTR(flags, (S_IRUGO | S_IWUGO), &show_flags, store_flags);
+static ssize_t store_debounce_flag(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
+{
+ unsigned flag;
+
+ if (!gpio_evmi)
+ return -ENODEV;
+
+ sscanf(buf, "%u", &flag);
+
+ if (flag) {
+ gpio_evmi->flags |= GPIOKPF_DEBOUNCE;
+ } else {
+ gpio_evmi->flags &= ~GPIOKPF_DEBOUNCE;
+ }
+
+ return count;
+}
+
+static ssize_t show_remove_some_phantom_keys_flag(struct device *dev, struct device_attribute *attr, char *buf)
+{
+ if (!gpio_evmi)
+ return -ENODEV;
+
+ return snprintf(buf, PAGE_SIZE, "%u\n", (gpio_evmi->flags & GPIOKPF_REMOVE_SOME_PHANTOM_KEYS) ? 1 : 0);
+}
+
+static ssize_t store_remove_some_phantom_keys_flag(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
+{
+ unsigned flag;
+
+ if (!gpio_evmi)
+ return -ENODEV;
+
+ sscanf(buf, "%u", &flag);
+
+ if (flag) {
+ gpio_evmi->flags |= GPIOKPF_REMOVE_SOME_PHANTOM_KEYS;
+ } else {
+ gpio_evmi->flags &= ~GPIOKPF_REMOVE_SOME_PHANTOM_KEYS;
+ }
+
+ return count;
+}
+
+static ssize_t show_print_unmapped_keys_flag(struct device *dev, struct device_attribute *attr, char *buf)
+{
+ if (!gpio_evmi)
+ return -ENODEV;
+
+ return snprintf(buf, PAGE_SIZE, "%u\n", (gpio_evmi->flags & GPIOKPF_PRINT_UNMAPPED_KEYS) ? 1 : 0);
+}
+
+static ssize_t store_print_unmapped_keys_flag(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
+{
+ unsigned flag;
+
+ if (!gpio_evmi)
+ return -ENODEV;
+
+ sscanf(buf, "%u", &flag);
+
+ if (flag) {
+ gpio_evmi->flags |= GPIOKPF_PRINT_UNMAPPED_KEYS;
+ } else {
+ gpio_evmi->flags &= ~GPIOKPF_PRINT_UNMAPPED_KEYS;
+ }
+
+ return count;
+}
+
+static ssize_t show_print_mapped_keys_flag(struct device *dev, struct device_attribute *attr, char *buf)
+{
+ if (!gpio_evmi)
+ return -ENODEV;
+
+ return snprintf(buf, PAGE_SIZE, "%u\n", (gpio_evmi->flags & GPIOKPF_PRINT_MAPPED_KEYS) ? 1 : 0);
+}
+
+static ssize_t store_print_mapped_keys_flag(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
+{
+ unsigned flag;
+
+ if (!gpio_evmi)
+ return -ENODEV;
+
+ sscanf(buf, "%u", &flag);
+
+ if (flag) {
+ gpio_evmi->flags |= GPIOKPF_PRINT_MAPPED_KEYS;
+ } else {
+ gpio_evmi->flags &= ~GPIOKPF_PRINT_MAPPED_KEYS;
+ }
+
+ return count;
+}
+
+static ssize_t show_print_phantom_keys_flag(struct device *dev, struct device_attribute *attr, char *buf)
+{
+ if (!gpio_evmi)
+ return -ENODEV;
+
+ return snprintf(buf, PAGE_SIZE, "%u\n", (gpio_evmi->flags & GPIOKPF_PRINT_PHANTOM_KEYS) ? 1 : 0);
+}
+
+static ssize_t store_print_phantom_keys_flag(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
+{
+ unsigned flag;
+
+ if (!gpio_evmi)
+ return -ENODEV;
+
+ sscanf(buf, "%u", &flag);
+
+ if (flag) {
+ gpio_evmi->flags |= GPIOKPF_PRINT_PHANTOM_KEYS;
+ } else {
+ gpio_evmi->flags &= ~GPIOKPF_PRINT_PHANTOM_KEYS;
+ }
+
+ return count;
+}
+
+static DEVICE_ATTR(debounce_delay, (S_IRUGO | S_IWUGO), show_debounce_delay, store_debounce_delay);
+static DEVICE_ATTR(settle_time, (S_IRUGO | S_IWUGO), show_settle_time, store_settle_time);
+static DEVICE_ATTR(poll_time, (S_IRUGO | S_IWUGO), show_poll_time, store_poll_time);
+static DEVICE_ATTR(flags, (S_IRUGO), show_flags, store_flags);
+static DEVICE_ATTR(debounce_flag, (S_IRUGO | S_IWUGO), show_debounce_flag, store_debounce_flag);
+static DEVICE_ATTR(remove_some_phantom_keys_flag, (S_IRUGO | S_IWUGO), show_remove_some_phantom_keys_flag, store_remove_some_phantom_keys_flag);
+static DEVICE_ATTR(print_unmapped_keys_flag, (S_IRUGO | S_IWUGO), show_print_unmapped_keys_flag, store_print_unmapped_keys_flag);
+static DEVICE_ATTR(print_mapped_keys_flag, (S_IRUGO | S_IWUGO), show_print_mapped_keys_flag, store_print_mapped_keys_flag);
+static DEVICE_ATTR(print_phantom_keys_flag, (S_IRUGO | S_IWUGO), show_print_phantom_keys_flag, store_print_phantom_keys_flag);
static void debounce_release(struct device *dev)
{
err = device_create_file(&debounce_device, &dev_attr_settle_time);
err = device_create_file(&debounce_device, &dev_attr_poll_time);
err = device_create_file(&debounce_device, &dev_attr_flags);
+ err = device_create_file(&debounce_device, &dev_attr_debounce_flag);
+ err = device_create_file(&debounce_device, &dev_attr_remove_some_phantom_keys_flag);
+ err = device_create_file(&debounce_device, &dev_attr_print_unmapped_keys_flag);
+ err = device_create_file(&debounce_device, &dev_attr_print_mapped_keys_flag);
+ err = device_create_file(&debounce_device, &dev_attr_print_phantom_keys_flag);
printk(KERN_INFO PREFIX "settle_time: %u\n", gpio_evmi->settle_time.tv.nsec);
printk(KERN_INFO PREFIX "poll_time: %u\n", gpio_evmi->poll_time.tv.nsec);
old_flags = gpio_evmi->flags;
set_debounce_delay(debounce_delay);
-#if 0
- gpio_evmi->flags &= ~GPIOKPF_REMOVE_SOME_PHANTOM_KEYS;
-#endif
+
printk(KERN_INFO PREFIX "flags: 0x%x\n", gpio_evmi->flags);
return 0;
device_remove_file(&debounce_device, &dev_attr_settle_time);
device_remove_file(&debounce_device, &dev_attr_poll_time);
device_remove_file(&debounce_device, &dev_attr_flags);
+ device_remove_file(&debounce_device, &dev_attr_debounce_flag);
+ device_remove_file(&debounce_device, &dev_attr_remove_some_phantom_keys_flag);
+ device_remove_file(&debounce_device, &dev_attr_print_unmapped_keys_flag);
+ device_remove_file(&debounce_device, &dev_attr_print_mapped_keys_flag);
+ device_remove_file(&debounce_device, &dev_attr_print_phantom_keys_flag);
device_unregister(&debounce_device);
}