Index: firmware/drivers/button.c
===================================================================
RCS file: /cvsroot/rockbox/firmware/drivers/button.c,v
retrieving revision 1.130
diff -p -u -d -r1.130 button.c
--- firmware/drivers/button.c	19 Mar 2006 01:12:28 -0000	1.130
+++ firmware/drivers/button.c	19 Mar 2006 16:06:47 -0000
@@ -68,7 +68,7 @@ static bool flipped;  /* buttons can be 
 /* the power-off button and number of repeated keys before shutting off */
 #if (CONFIG_KEYPAD == IPOD_3G_PAD) || (CONFIG_KEYPAD == IPOD_4G_PAD) ||\
     (CONFIG_KEYPAD == IRIVER_IFP7XX_PAD)
-#define POWEROFF_BUTTON BUTTON_PLAY
+#define POWEROFF_BUTTON (BUTTON_PLAY | BUTTON_SELECT)
 #define POWEROFF_COUNT 40
 #elif (CONFIG_KEYPAD == IAUDIO_X5_PAD)
 #define POWEROFF_BUTTON BUTTON_POWER
@@ -87,6 +87,8 @@ static bool remote_button_hold_only(void
 #if CONFIG_KEYPAD == IPOD_4G_PAD
 /* Variable to use for setting button status in interrupt handler */
 int int_btn = BUTTON_NONE;
+int int_wheel = -1;
+int send_events = 1;
 #endif
 
 #if (CONFIG_KEYPAD == IPOD_4G_PAD) && (!defined(APPLE_IPODMINI))
@@ -124,6 +126,8 @@ static void opto_i2c_init(void)
 
 static inline int ipod_4g_button_read(void)
 {
+    int whl = -1;
+    
     /* The ipodlinux source had a udelay(250) here, but testing has shown that
        it is not needed - tested on Nano, Color/Photo and Video. */
     /* udelay(250);*/
@@ -153,6 +157,7 @@ static inline int ipod_4g_button_read(vo
             if (status & 0x40000000) {
                 /* NB: highest wheel = 0x5F, clockwise increases */
                 int new_wheel_value = (status << 9) >> 25;
+                whl = new_wheel_value;
                 backlight_on();
                 /* The queue should have no other events when scrolling */
                 if (queue_empty(&button_queue) && old_wheel_value >= 0) {
@@ -167,15 +172,17 @@ static inline int ipod_4g_button_read(vo
                     else if (wheel_delta > 48)
                         wheel_delta -= 96; /* Backward wrapping case */
 
-                    if (wheel_delta > 4) {
+                    if (wheel_delta > 10) {
                         wheel_keycode = BUTTON_SCROLL_FWD;
-                    } else if (wheel_delta < -4) {
+                    } else if (wheel_delta < -10) {
                         wheel_keycode = BUTTON_SCROLL_BACK;
                     } else goto wheel_end;
 
-                    data = (wheel_delta << 16) | new_wheel_value;
-                    queue_post(&button_queue, wheel_keycode | wheel_repeat,
-                            (void *)data);
+                    if (send_events) {
+                        data = (wheel_delta << 16) | new_wheel_value;
+                        queue_post(&button_queue, wheel_keycode | wheel_repeat,
+                                (void *)data);
+                    }
 
                     if (!wheel_repeat) wheel_repeat = BUTTON_REPEAT;
                 }
@@ -198,6 +205,7 @@ wheel_end:
         outl(0xffffffff, 0x7000c120);
         outl(0xffffffff, 0x7000c124);
     }
+    int_wheel = whl;
     return btn;
 }
 
@@ -1260,6 +1268,18 @@ int button_status(void)
     return lastbtn;
 }
 
+#if (CONFIG_KEYPAD == IPOD_4G_PAD)
+int wheel_status(void)
+{
+    return int_wheel;
+}
+
+void wheel_send_events(bool send)
+{
+    send_events = send;
+}
+#endif
+
 void button_clear_queue(void)
 {
     queue_clear(&button_queue);
