]> cvs.zerfleddert.de Git - ms2-fixes/commitdiff
update module for more matrix-flags
authorMichael Gernoth <michael@gernoth.net>
Sun, 31 Jul 2011 11:02:22 +0000 (13:02 +0200)
committerMichael Gernoth <michael@gernoth.net>
Sun, 31 Jul 2011 11:02:22 +0000 (13:02 +0200)
MS2Debounce/assets/debounce.ko
debounce.c

index ebcac51d9e3444f34e36a4a76778882b51d8630e..26b98240a325243e91bf0a385636577f094e422c 100644 (file)
Binary files a/MS2Debounce/assets/debounce.ko and b/MS2Debounce/assets/debounce.ko differ
index 029ff91cc02a8ec8bfeae6a5749f51fff4275da2..f2793a4c10f0c58ea3f67c1e5970be9c7247b5ec 100644 (file)
@@ -125,9 +125,6 @@ static ssize_t store_flags(struct device *dev, struct device_attribute *attr, co
 
        printk(KERN_INFO PREFIX "flags: 0x%x\n", flags);
 
-       if (flags & GPIOKPF_DRIVE_INACTIVE)
-               return count;
-
        gpio_evmi->flags = flags;
 
        return count;
@@ -263,6 +260,58 @@ static ssize_t store_print_phantom_keys_flag(struct device *dev, struct device_a
        return count;
 }
 
+static ssize_t show_active_high_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_ACTIVE_HIGH) ? 1 : 0);
+}
+
+static ssize_t store_active_high_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_ACTIVE_HIGH;
+       } else {
+               gpio_evmi->flags &= ~GPIOKPF_ACTIVE_HIGH;
+       }
+
+       return count;
+}
+
+static ssize_t show_drive_inactive_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_DRIVE_INACTIVE) ? 1 : 0);
+}
+
+static ssize_t store_drive_inactive_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_DRIVE_INACTIVE;
+       } else {
+               gpio_evmi->flags &= ~GPIOKPF_DRIVE_INACTIVE;
+       }
+
+       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);
@@ -272,6 +321,8 @@ static DEVICE_ATTR(remove_some_phantom_keys_flag, (S_IRUGO | S_IWUGO), show_remo
 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 DEVICE_ATTR(active_high_flag, (S_IRUGO), show_active_high_flag, store_active_high_flag);
+static DEVICE_ATTR(drive_inactive_flag, (S_IRUGO | S_IWUGO), show_drive_inactive_flag, store_drive_inactive_flag);
 
 static void debounce_release(struct device *dev)
 {
@@ -317,6 +368,8 @@ static int __init debounce_init(void)
        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);
+       err = device_create_file(&debounce_device, &dev_attr_active_high_flag);
+       err = device_create_file(&debounce_device, &dev_attr_drive_inactive_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);
@@ -358,6 +411,8 @@ static void __exit debounce_exit(void)
        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_remove_file(&debounce_device, &dev_attr_active_high_flag);
+       device_remove_file(&debounce_device, &dev_attr_drive_inactive_flag);
        device_unregister(&debounce_device);
 }
 
Impressum, Datenschutz