Author: titmuss
Date: Fri Apr  4 05:33:32 2008
New Revision: 2169

URL: http://svn.slimdevices.com?rev=2169&root=Jive&view=rev
Log:
Bug: 7555
Description:
Make selecting after scrolling less touchy. As suggested in the bug/forums:
- re-center the scroll wheel in a detent after half a second.
- re-center the scroll wheel in a detent when the center button is pressed.


Modified:
    trunk/squeezeos/src/s3c2412/linux-2.6.22/.config
    trunk/squeezeos/src/s3c2412/linux-2.6.22/drivers/char/jive/jive_matrix.c
    trunk/squeezeos/src/s3c2412/linux-2.6.22/drivers/char/jive/jive_wheel.c

Modified: trunk/squeezeos/src/s3c2412/linux-2.6.22/.config
URL: 
http://svn.slimdevices.com/trunk/squeezeos/src/s3c2412/linux-2.6.22/.config?rev=2169&root=Jive&r1=2168&r2=2169&view=diff
==============================================================================
--- trunk/squeezeos/src/s3c2412/linux-2.6.22/.config (original)
+++ trunk/squeezeos/src/s3c2412/linux-2.6.22/.config Fri Apr  4 05:33:32 2008
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
 # Linux kernel version: 2.6.22
-# Sun Feb 10 11:26:29 2008
+# Thu Apr  3 13:27:53 2008
 #
 CONFIG_ARM=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -586,7 +586,7 @@
 # Userland interfaces
 #
 CONFIG_INPUT_MOUSEDEV=y
-CONFIG_INPUT_MOUSEDEV_PSAUX=y
+# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
 CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
 CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
 # CONFIG_INPUT_JOYDEV is not set
@@ -606,13 +606,7 @@
 # CONFIG_KEYBOARD_STOWAWAY is not set
 # CONFIG_KEYBOARD_GPIO is not set
 CONFIG_INPUT_MOUSE=y
-CONFIG_MOUSE_PS2=y
-CONFIG_MOUSE_PS2_ALPS=y
-CONFIG_MOUSE_PS2_LOGIPS2PP=y
-CONFIG_MOUSE_PS2_SYNAPTICS=y
-CONFIG_MOUSE_PS2_LIFEBOOK=y
-CONFIG_MOUSE_PS2_TRACKPOINT=y
-# CONFIG_MOUSE_PS2_TOUCHKIT is not set
+# CONFIG_MOUSE_PS2 is not set
 # CONFIG_MOUSE_SERIAL is not set
 # CONFIG_MOUSE_APPLETOUCH is not set
 # CONFIG_MOUSE_VSXXXAA is not set

Modified: 
trunk/squeezeos/src/s3c2412/linux-2.6.22/drivers/char/jive/jive_matrix.c
URL: 
http://svn.slimdevices.com/trunk/squeezeos/src/s3c2412/linux-2.6.22/drivers/char/jive/jive_matrix.c?rev=2169&root=Jive&r1=2168&r2=2169&view=diff
==============================================================================
--- trunk/squeezeos/src/s3c2412/linux-2.6.22/drivers/char/jive/jive_matrix.c 
(original)
+++ trunk/squeezeos/src/s3c2412/linux-2.6.22/drivers/char/jive/jive_matrix.c 
Fri Apr  4 05:33:32 2008
@@ -49,28 +49,24 @@
        //  KEY_INPUT0
        //  KEY_INPUT1
        //  KEY_INPUT2
-       //  KEY_INPUT3
 
        // KEY_OUTPUT2
        KEY_UNKNOWN,
        KEY_B, // SW10 Fwd
        KEY_Z, // SW9 Rew
        KEY_C, // SW8 Pause
-       KEY_UNKNOWN,
 
        // KEY_OUTPUT1
        KEY_UNKNOWN,
        KEY_X, // SW5 Play
        KEY_A, // SW6 Add
        KEY_EQUAL, // SW7 Volume Up
-       KEY_UNKNOWN,
 
        // KEY_OUTPUT0
        KEY_H, // SW1 Home
        KEY_UNKNOWN,
        KEY_LEFT, // SW2 Back
        KEY_MINUS, // SW3 Volume Down
-       KEY_RIGHT, // SW16 Go
 };
 
 #define IRQF_TRIGGER_BOTH (IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING)
@@ -83,7 +79,6 @@
        [1] = IRQ_EINT4,
        [2] = IRQ_EINT5,
        [3] = IRQ_EINT6,
-       [4] = IRQ_EINT7,
 };
 
 static inline unsigned int matrix_read_gpio(void)
@@ -95,7 +90,6 @@
        ret |= s3c2410_gpio_getpin(S3C2410_GPF4) ? (1 << 1) : 0;
        ret |= s3c2410_gpio_getpin(S3C2410_GPF5) ? (1 << 2) : 0;
        ret |= s3c2410_gpio_getpin(S3C2410_GPF6) ? (1 << 3) : 0;
-       ret |= s3c2410_gpio_getpin(S3C2410_GPF7) ? (1 << 4) : 0;
 
        return ret;
 }
@@ -116,7 +110,7 @@
                s3c2410_gpio_cfgpin(S3C2410_GPF1, (i == 1) ? 
S3C2410_GPIO_OUTPUT : S3C2410_GPIO_INPUT);
                s3c2410_gpio_cfgpin(S3C2410_GPF2, (i == 2) ? 
S3C2410_GPIO_OUTPUT : S3C2410_GPIO_INPUT);
 
-               state[index] <<= 5;
+               state[index] <<= 4;
                state[index] |= matrix_read_gpio();
        }
 
@@ -155,7 +149,6 @@
                s3c2410_gpio_cfgpin(S3C2410_GPF4, S3C2410_GPIO_SFN2);
                s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPIO_SFN2);
                s3c2410_gpio_cfgpin(S3C2410_GPF6, S3C2410_GPIO_SFN2);
-               s3c2410_gpio_cfgpin(S3C2410_GPF7, S3C2410_GPIO_SFN2);
        }
 }
 
@@ -165,7 +158,6 @@
        s3c2410_gpio_cfgpin(S3C2410_GPF4, S3C2410_GPIO_INPUT);
        s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPIO_INPUT);
        s3c2410_gpio_cfgpin(S3C2410_GPF6, S3C2410_GPIO_INPUT);
-       s3c2410_gpio_cfgpin(S3C2410_GPF7, S3C2410_GPIO_INPUT);
 
        /* scan matrix */
        mod_timer(&matrix_timer, jiffies); // now
@@ -218,7 +210,7 @@
        /* Remove pull-down on all pins, either outputs or are being
         * driven from an external source. */
 
-       for (gpio = S3C2410_GPF0; gpio <= S3C2410_GPF7; gpio++) {
+       for (gpio = S3C2410_GPF0; gpio <= S3C2410_GPF6; gpio++) {
                s3c2410_gpio_pullup(gpio, 1);
        }
 

Modified: 
trunk/squeezeos/src/s3c2412/linux-2.6.22/drivers/char/jive/jive_wheel.c
URL: 
http://svn.slimdevices.com/trunk/squeezeos/src/s3c2412/linux-2.6.22/drivers/char/jive/jive_wheel.c?rev=2169&root=Jive&r1=2168&r2=2169&view=diff
==============================================================================
--- trunk/squeezeos/src/s3c2412/linux-2.6.22/drivers/char/jive/jive_wheel.c 
(original)
+++ trunk/squeezeos/src/s3c2412/linux-2.6.22/drivers/char/jive/jive_wheel.c Fri 
Apr  4 05:33:32 2008
@@ -61,31 +61,45 @@
 
 static int pos;
 
-static int lastAB;
+static unsigned int lastAB;
 
 static unsigned int state[PRESS_TIME_MS / DEBOUNCE_PERIOD_MS];
 
+static unsigned int last_button;
+
 static unsigned int count;
 
 static unsigned int index;
 
+static unsigned long click_jiffies;
+
 static struct input_dev *wheel_dev;
 
 struct timer_list wheel_timer;
+
+
+static unsigned int wheel_irqs[] = {
+       [0] = IRQ_EINT12,
+       [1] = IRQ_EINT13,
+       [2] = IRQ_EINT7,
+};
 
 
 static void wheel_scan(unsigned long data)
 {              
-       int i, AB, ABCD;
+       unsigned int i, AB, ABCD, button;
 
        if (++index >= ARRAY_SIZE(state)) {
                index = 0;
        }
 
-       // read A and B
+       /* read A and B */
        state[index] = s3c2410_gpio_getpin(S3C2410_GPG4) ? (1 << 0) : 0;
        state[index] |= s3c2410_gpio_getpin(S3C2410_GPG5) ? (1 << 1) : 0;
 
+       /* read center button */
+       button = last_button << 1;
+       button |= s3c2410_gpio_getpin(S3C2410_GPF7) ? 1 : 0;
 
        /* debounce switches */
        AB = 0xFF;
@@ -93,6 +107,12 @@
                AB &= state[i];
        }
 
+       /* reset after a second */
+       if (jiffies > click_jiffies + HZ/2) {
+               pos = 0;
+               click_jiffies = jiffies;
+       }
+       
 
        /* CW rotation:
         * A B  C D (CD are previous AB state)
@@ -122,7 +142,7 @@
                pos += 1;
                count = 0;
                lastAB = AB;
-               //printk(KERN_DEBUG "\tAB %x ABCD %x  1\n", AB, ABCD);
+               click_jiffies = jiffies;
                break;
 
        case 0xB:
@@ -133,7 +153,7 @@
                pos -= 1;
                count = 0;
                lastAB = AB;
-               //printk(KERN_DEBUG "\tAB %x ABCD %x  -1\n", AB, ABCD);
+               click_jiffies = jiffies;
                break;
 
        case 0x0:
@@ -145,8 +165,17 @@
 
        default:
                /* impossible state */
-               printk(KERN_INFO "bad wheel state %x\n", ABCD);
-       }
+               break;
+       }
+
+
+       /* button press? */
+       if ((button & 0xFF) != (last_button & 0xFF)) {
+               input_report_key(wheel_dev, KEY_RIGHT, (button & 0xFF) > 0);
+               input_sync(wheel_dev);
+               pos = 0;
+       }
+       last_button = button;
 
 
        /* update detent */
@@ -162,7 +191,7 @@
                pos = 0;
        }
 
-       if (count++ < (RELEASE_TIME_MS / DEBOUNCE_PERIOD_MS)) {
+       if (count++ < (RELEASE_TIME_MS / DEBOUNCE_PERIOD_MS) || button > 0) {
                /* keep scanning while wheel is rotating */
                mod_timer(&wheel_timer, jiffies + (DEBOUNCE_PERIOD_MS * 
HZ/1000));
        }
@@ -170,6 +199,7 @@
                /* return the lines to interrupt */
                s3c2410_gpio_cfgpin(S3C2410_GPG4, S3C2410_GPIO_SFN2);
                s3c2410_gpio_cfgpin(S3C2410_GPG5, S3C2410_GPIO_SFN2);
+               s3c2410_gpio_cfgpin(S3C2410_GPF7, S3C2410_GPIO_SFN2);
        }
 
        return;
@@ -179,6 +209,7 @@
 {
        s3c2410_gpio_cfgpin(S3C2410_GPG4, S3C2410_GPIO_INPUT);
        s3c2410_gpio_cfgpin(S3C2410_GPG5, S3C2410_GPIO_INPUT);
+       s3c2410_gpio_cfgpin(S3C2410_GPF7, S3C2410_GPIO_INPUT);
 
        /* scan wheel */
        mod_timer(&wheel_timer, jiffies); // now
@@ -186,12 +217,16 @@
        return IRQ_HANDLED;
 }              
 
-
-#define IRQ_FLAGS IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | 
IRQF_SAMPLE_RANDOM
+#define IRQF_TRIGGER_BOTH (IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING)
+
+/* use IRQF_DISABLED to ensure that we aren't re-entered */
+#define IRQ_FLAGS IRQF_SAMPLE_RANDOM | IRQF_TRIGGER_BOTH | IRQF_DISABLED
+
 
 static int __init wheel_init(void)
 {
-       int i;
+       unsigned int gpio;
+       int i, ret;
 
        /* For compatibility with the old bootloader allow s3c2413 machines
         * to work here too. We can't use machine_is_s3c2413() here as that
@@ -211,9 +246,11 @@
                return -ENOMEM;
        }
 
-       wheel_dev->evbit[0] = BIT(EV_REL);
+       wheel_dev->evbit[0] = BIT(EV_REL) | BIT(EV_KEY) | BIT(EV_REP);
        wheel_dev->relbit[0] = BIT(REL_WHEEL);
        wheel_dev->name = "Wheel";
+
+       set_bit(KEY_RIGHT, wheel_dev->keybit); // Go
 
        input_register_device(wheel_dev);
 
@@ -227,26 +264,49 @@
        init_timer(&wheel_timer);
        wheel_timer.function = wheel_scan;
 
-
-        if (request_irq(IRQ_EINT12, wheel_irq, IRQ_FLAGS, "CCW_B", NULL)) {
-                 printk(KERN_ERR "Could not allocate CCW_B on IRQ_EINT12 !\n");
-                 return -EIO;
-       }
-
-        if (request_irq(IRQ_EINT13, wheel_irq, IRQ_FLAGS, "CW_A", NULL)) {
-                 printk(KERN_ERR "Could not allocate CW_A on IRQ_EINT13 !\n");
-                 return -EIO;
-       }
-
-       s3c2410_gpio_irqfilter(S3C2410_GPG4, 1, 0);
-       s3c2410_gpio_irqfilter(S3C2410_GPG5, 1, 0);
+       for (gpio = 0; gpio < ARRAY_SIZE(wheel_irqs); gpio++) {
+               int irq = wheel_irqs[gpio];
+
+               ret = request_irq(irq, wheel_irq, IRQ_FLAGS,
+                                 "wheel", NULL);
+               if (ret < 0) {
+                       printk(KERN_ERR "Failed to request IRQ %d (error 
%d)\n", gpio, ret);
+                       goto err;
+               }
+
+               ret = set_irq_wake(irq, 1);
+               if (ret < 0) {
+                       printk(KERN_ERR "Failed to set wake on IRQ %d (error 
%d)\n",
+                              gpio, ret);
+                       goto err;
+               }
+
+               s3c2410_gpio_irqfilter(s3c2410_gpio_irq2pin(irq), 1, 0);
+       }
 
        return 0;
+
+ err:
+       for (gpio = 0; gpio < ARRAY_SIZE(wheel_irqs); gpio++) {
+               int irq = wheel_irqs[gpio];
+
+               set_irq_wake(irq, 0);
+               free_irq(irq, NULL);
+       }
+
+       input_unregister_device(wheel_dev);
+       return -EIO;
 }
 
 static void __exit wheel_exit(void) {
-       free_irq(IRQ_EINT12, NULL);
-       free_irq(IRQ_EINT13, NULL);
+       unsigned int gpio;
+
+       for (gpio = 0; gpio < ARRAY_SIZE(wheel_irqs); gpio++) {
+               int irq = wheel_irqs[gpio];
+
+               set_irq_wake(irq, 0);
+               free_irq(irq, NULL);
+       }
 
        input_unregister_device(wheel_dev);
 }

_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/cgi-bin/mailman/listinfo/jive-checkins

Reply via email to