diff -Nru rockbox-allOrig/apps/lang/english.lang rockbox/apps/lang/english.lang
--- rockbox-allOrig/apps/lang/english.lang	2006-07-24 20:58:29.000000000 +0200
+++ rockbox/apps/lang/english.lang	2006-07-24 17:46:00.000000000 +0200
@@ -8777,3 +8777,31 @@
     *: "Stop recording"
   </voice>
 </phrase>
+<phrase>
+  id: LANG_BUTTON_BEEP_LENGTH
+  desc: in lcd options
+  user:
+  <source>
+    *: "Button click duration"
+  </source>
+  <dest>
+    *: "Button click duration"
+  </dest>
+  <voice>
+    *: "Button click duration"
+  </voice>
+</phrase>
+<phrase>
+  id: LANG_BUTTON_BEEP_FREQUENCY
+  desc: in lcd options
+  user:
+  <source>
+    *: "Button click frequency"
+  </source>
+  <dest>
+    *: "Button click frequency"
+  </dest>
+  <voice>
+    *: "Button click frequency"
+  </voice>
+</phrase>
\ No newline at end of file
diff -Nru rockbox-allOrig/apps/main.c rockbox/apps/main.c
--- rockbox-allOrig/apps/main.c	2006-07-21 17:56:24.000000000 +0200
+++ rockbox/apps/main.c	2006-07-24 17:53:50.000000000 +0200
@@ -88,6 +88,10 @@
 #include "lcd-remote.h"
 #endif
 
+#ifdef HAVE_PIEZO
+#include "piezo.h"
+#endif
+
 #if CONFIG_USBOTG == USBOTG_ISP1362
 #include "isp1362.h"
 #endif
@@ -449,6 +453,10 @@
 #ifdef CONFIG_CHARGING
     car_adapter_mode_init();
 #endif
+
+#ifdef HAVE_PIEZO
+    piezo_init();
+#endif
 }
 
 int main(void)
diff -Nru rockbox-allOrig/apps/recorder/keyboard.c rockbox/apps/recorder/keyboard.c
--- rockbox-allOrig/apps/recorder/keyboard.c	2006-07-24 20:58:30.000000000 +0200
+++ rockbox/apps/recorder/keyboard.c	2006-07-24 18:55:28.000000000 +0200
@@ -859,14 +859,26 @@
 #endif
                     FOR_NB_SCREENS(l)
                     {
+                        if (param[l].y == param[l].lines - 1)
+                            line_edit = true;
                         if (param[l].y < param[l].lines - 1)
                             param[l].y++;
                         else
 #ifndef KBD_MODES
+<<<<<<< keyboard.c
+                        else
+                            param[l].y=0;
+                     }
+=======
                             param[l].y=0;}
+>>>>>>> 1.55
 #else
+<<<<<<< keyboard.c
+                     }
+=======
                             line_edit = true;
                     }
+>>>>>>> 1.55
                 }
                 if (!line_edit)
 #endif
diff -Nru rockbox-allOrig/apps/settings.c rockbox/apps/settings.c
--- rockbox-allOrig/apps/settings.c	2006-07-24 20:58:28.000000000 +0200
+++ rockbox/apps/settings.c	2006-07-24 18:55:20.000000000 +0200
@@ -571,7 +571,10 @@
 
     {1, S_O(warnon_erase_dynplaylist), false,
         "warn when erasing dynamic playlist", off_on },
-
+#ifdef HAVE_PIEZO
+    {8 | SIGNED, S_O(button_beep_frequency), 27, "button_beep_freq", NULL},
+    {8 | SIGNED, S_O(button_beep_length), 0, "button_beep_len", NULL},
+#endif
     
     /* If values are just added to the end, no need to bump the version. */
     /* new stuff to be added at the end */
@@ -1180,6 +1183,9 @@
     set_remote_backlight_filter_keypress(global_settings.remote_bl_filter_first_keypress);
 #endif
 #endif
+#ifdef HAVE_PIEZO
+    set_button_beep_type((unsigned short)global_settings.button_beep_length,(unsigned short)global_settings.button_beep_frequency);
+#endif
 }
 
 
@@ -1745,7 +1751,10 @@
 #ifdef HAVE_LCD_BITMAP
     global_settings.kbd_file[0] = '\0';
 #endif
-
+#ifdef HAVE_PIEZO
+    global_settings.button_beep_frequency=27;
+    global_settings.button_beep_length=0;//length 0 (not enabled) by default.
+#endif
 }
 
 bool set_bool(const char* string, bool* variable )
diff -Nru rockbox-allOrig/apps/settings.h rockbox/apps/settings.h
--- rockbox-allOrig/apps/settings.h	2006-07-24 20:58:28.000000000 +0200
+++ rockbox/apps/settings.h	2006-07-24 18:55:20.000000000 +0200
@@ -517,6 +517,10 @@
 #ifdef HAVE_LCD_BITMAP
     unsigned char kbd_file[MAX_FILENAME+1]; /* last keyboard */
 #endif
+#ifdef HAVE_PIEZO
+    int button_beep_length;
+    int button_beep_frequency;
+#endif
 };
 
 enum optiontype { INT, BOOL };
diff -Nru rockbox-allOrig/apps/settings_menu.c rockbox/apps/settings_menu.c
--- rockbox-allOrig/apps/settings_menu.c	2006-07-24 20:58:28.000000000 +0200
+++ rockbox/apps/settings_menu.c	2006-07-24 18:55:20.000000000 +0200
@@ -890,6 +890,27 @@
 
 #endif
 
+#ifdef HAVE_PIEZO
+static void lcd_button_beep_freq(int freq){
+	set_button_beep_type((unsigned short)global_settings.button_beep_length,(unsigned short)freq);
+}
+static void lcd_button_beep_len(int len){
+	set_button_beep_type((unsigned short)len,(unsigned short)global_settings.button_beep_frequency);
+}
+static bool button_beep_frequency(void)
+{
+    return set_int(str(LANG_BUTTON_BEEP_FREQUENCY), "", UNIT_INT,
+                   &global_settings.button_beep_frequency,
+                   &lcd_button_beep_freq, 1, 0, 250, NULL );
+}
+static bool button_beep_length(void)
+{
+    return set_int(str(LANG_BUTTON_BEEP_LENGTH), "", UNIT_INT,
+                   &global_settings.button_beep_length,
+                   &lcd_button_beep_len, 1, 0, 100, NULL );
+}
+#endif
+
 #ifdef HAVE_LCD_BITMAP
 static bool screen_scroll(void)
 {
@@ -1506,7 +1527,6 @@
     bool ret;
     ret=set_option( str(LANG_BEEP),
                     &global_settings.beep, INT, names, 4, NULL);
-
     return ret;
 }
 #endif
@@ -1793,6 +1813,10 @@
 #endif
         { ID2P(LANG_INVERT_CURSOR),   invert_cursor },
 #endif
+#ifdef HAVE_PIEZO
+        { ID2P(LANG_BUTTON_BEEP_LENGTH) , button_beep_length },
+        { ID2P(LANG_BUTTON_BEEP_FREQUENCY) , button_beep_frequency },
+#endif
 #ifdef HAVE_LCD_COLOR
         { ID2P(LANG_CLEAR_BACKDROP),   clear_main_backdrop },
         { ID2P(LANG_BACKGROUND_COLOR), set_bg_color },
diff -Nru rockbox-allOrig/firmware/drivers/button.c rockbox/firmware/drivers/button.c
--- rockbox-allOrig/firmware/drivers/button.c	2006-07-21 17:56:25.000000000 +0200
+++ rockbox/firmware/drivers/button.c	2006-07-24 17:41:36.000000000 +0200
@@ -44,6 +44,10 @@
 #include "lcd-remote.h"
 #endif
 
+#ifdef HAVE_PIEZO
+#include "piezo.h"
+#endif
+
 struct event_queue button_queue;
 
 static long lastbtn;   /* Last valid button status */
@@ -57,6 +61,10 @@
 static bool remote_filter_first_keypress;
 #endif
 #endif
+#ifdef HAVE_PIEZO
+static unsigned short button_beep_length=0;
+static unsigned short button_beep_frequency=27;
+#endif
 
 /* how long until repeat kicks in, in ticks */
 #define REPEAT_START      30
@@ -178,7 +186,7 @@
                     data = (wheel_delta << 16) | new_wheel_value;
                     queue_post(&button_queue, wheel_keycode | wheel_repeat,
                             (void *)data);
-
+                    button_beep(1);
                     if (!wheel_repeat) wheel_repeat = BUTTON_REPEAT;
                 }
 
@@ -272,8 +280,10 @@
             }
         }
     }
-    if (wheel_keycode != BUTTON_NONE && queue_empty(&button_queue))
+    if (wheel_keycode != BUTTON_NONE && queue_empty(&button_queue)){
         queue_post(&button_queue, wheel_keycode, NULL);
+	button_beep(0);
+    }
     prev_scroll = new_scroll;
 }
 #endif
@@ -429,6 +439,7 @@
     if(btn)
     {
         queue_post(&button_queue, btn, NULL);
+        button_beep(2);	
     }
 #endif
 
@@ -528,6 +539,7 @@
                     if (queue_empty(&button_queue))
                     {
                         queue_post(&button_queue, BUTTON_REPEAT | btn, NULL);
+			button_beep(1);
 #ifdef CONFIG_BACKLIGHT
 #ifdef HAVE_REMOTE_LCD
                         skip_remote_release = false;
@@ -548,17 +560,20 @@
 #endif
                             )
                             queue_post(&button_queue, btn, NULL);
+                            button_beep(2);
                         else
                             skip_remote_release = true;
                     }
                     else
 #endif
-                        if (!filter_first_keypress || is_backlight_on())
+                        if (!filter_first_keypress || is_backlight_on()){
                             queue_post(&button_queue, btn, NULL);
-                        else
+                            button_beep(0);
+                        }else
                             skip_release = true;
 #else /* no backlight, nothing to skip */
                     queue_post(&button_queue, btn, NULL);
+                    button_beep(0);
 #endif
                     post = false;
                 }
@@ -758,6 +773,13 @@
 #endif
 #endif
 
+#ifdef HAVE_PIEZO
+void set_button_beep_type(unsigned short length,unsigned short frequency)
+{
+    button_beep_length = length;
+    button_beep_frequency = frequency;
+}
+#endif
 /*
  Archos hardware button hookup
  =============================
@@ -1396,4 +1418,13 @@
 {
     queue_clear(&button_queue);
 }
-
+void button_beep(unsigned char tpe){
+#ifdef HAVE_PIEZO
+   if(button_beep_length>0){
+   	if(tpe==1)//scrolling wheel
+   		piezo_play_for(button_beep_frequency, button_beep_length*500);//inv_freq,ms(->us)
+   	else
+   		piezo_play_for(button_beep_frequency, button_beep_length*1000);//inv_freq,ms(->us)
+   }
+#endif
+}
diff -Nru rockbox-allOrig/firmware/drivers/piezo.c rockbox/firmware/drivers/piezo.c
--- rockbox-allOrig/firmware/drivers/piezo.c	1970-01-01 01:00:00.000000000 +0100
+++ rockbox/firmware/drivers/piezo.c	2006-07-24 17:42:36.000000000 +0200
@@ -0,0 +1,127 @@
+#include "thread.h"
+#include "system.h"
+#include "kernel.h"
+#include "usb.h"
+#include "logf.h"
+#include "piezo.h"
+
+static long piezo_stack[DEFAULT_STACK_SIZE/sizeof(long)];
+static const char piezo_thread_name[] = "piezo";
+static struct event_queue piezo_queue;
+unsigned int duration;
+bool beeping;
+
+enum {
+    Q_PIEZO_BEEP = 1,
+    Q_PIEZO_BEEP_FOR,
+    Q_PIEZO_STOP
+};
+
+static inline void piezo_hw_init(void)
+{
+    logf("PIEZO: hw_init");
+    outl(inl(0x70000010) & ~0xc, 0x70000010);
+    outl(inl(0x6000600c) | 0x20000, 0x6000600c);    /* enable device */
+}
+
+static void piezo_hw_tick(int period)
+{    
+    outl(0x80000000 | 0x800000 | period, 0x7000a000); /* set pitch */
+}
+
+static inline void piezo_hw_stop(void)
+{
+    outl(0x0, 0x7000a000);    /* piezo off */
+}
+
+/*
+void piezo_start_for(void)
+{
+    piezo_hw_tick(frequency);
+    sleep(duration);
+    piezo_hw_stop();
+}
+*/
+
+void piezo_thread(void)
+{
+    struct event ev;
+
+    while(1)
+    {
+        queue_wait(&piezo_queue, &ev);
+        switch(ev.id)
+        {
+            case Q_PIEZO_BEEP:
+                piezo_hw_tick((int)ev.data);
+                beeping = true;
+/*                logf("PIEZO: beep");*/
+                break;
+            case Q_PIEZO_BEEP_FOR:
+/*                logf("PIEZO: beep_for start");*/
+                piezo_hw_tick((int)ev.data);
+                beeping = true;
+                udelay(duration);
+		//sleep(duration);
+                if (beeping)
+                    piezo_hw_stop();
+                beeping = false;
+/*                logf("PIEZO: beep_for end");*/
+                /* remove anything that appeared while sleeping */
+                queue_clear(&piezo_queue);
+                break;
+            case Q_PIEZO_STOP:
+                if (beeping)
+                    piezo_hw_stop();
+                beeping = false;
+/*                logf("PIEZO: beep stop");*/
+                break;
+#ifndef SIMULATOR
+            case SYS_USB_CONNECTED:
+                /*logf("USB: Piezo core");*/
+                piezo_hw_stop();
+                usb_acknowledge(SYS_USB_CONNECTED_ACK);
+                usb_wait_for_disconnect(&piezo_queue);
+                break ;
+#endif
+            case SYS_TIMEOUT:
+                break;
+        }
+        yield();
+    }
+}
+
+void piezo_play(int inv_freq)
+{
+    queue_post(&piezo_queue, Q_PIEZO_BEEP, (int *)inv_freq);
+}
+/*duration in uSecs*/
+void piezo_play_for(int inv_freq, int dur)
+{
+    duration = dur;
+    queue_post(&piezo_queue, Q_PIEZO_BEEP_FOR, (int *)inv_freq);
+}
+
+void piezo_stop(void)
+{
+    queue_post(&piezo_queue, Q_PIEZO_STOP, NULL);
+}
+
+void piezo_clear(void)
+{
+    queue_clear(&piezo_queue);
+    piezo_stop();
+}
+
+bool piezo_busy(void)
+{
+    return !queue_empty(&piezo_queue);
+}
+
+void piezo_init(void)
+{
+    logf("PIEZO: init");
+    piezo_hw_init();
+    queue_init(&piezo_queue);
+    create_thread(piezo_thread, piezo_stack, sizeof(piezo_stack), piezo_thread_name);
+}
\ No newline at end of file
diff -Nru rockbox-allOrig/firmware/export/button.h rockbox/firmware/export/button.h
--- rockbox-allOrig/firmware/export/button.h	2006-07-21 17:56:25.000000000 +0200
+++ rockbox/firmware/export/button.h	2006-07-24 17:41:44.000000000 +0200
@@ -49,12 +49,17 @@
 #endif
 #endif
 
+#ifdef HAVE_PIEZO
+void set_button_beep_type(unsigned short length,unsigned short frequency);
+#endif
+
 #ifdef HAS_BUTTON_HOLD
 bool button_hold(void);
 #endif
 #ifdef HAS_REMOTE_BUTTON_HOLD
 bool remote_button_hold(void);
 #endif
+void button_beep(unsigned char tpe);
 
 
 #define  BUTTON_NONE        0x00000000
diff -Nru rockbox-allOrig/firmware/export/config-ipodvideo.h rockbox/firmware/export/config-ipodvideo.h
--- rockbox-allOrig/firmware/export/config-ipodvideo.h	2006-07-21 17:56:25.000000000 +0200
+++ rockbox/firmware/export/config-ipodvideo.h	2006-07-24 17:44:31.000000000 +0200
@@ -111,4 +111,6 @@
 #define BOOTFILE_EXT "ipod"
 #define BOOTFILE "rockbox." BOOTFILE_EXT
 
+#define HAVE_PIEZO
+
 #endif
diff -Nru rockbox-allOrig/firmware/export/piezo.h rockbox/firmware/export/piezo.h
--- rockbox-allOrig/firmware/export/piezo.h	1970-01-01 01:00:00.000000000 +0100
+++ rockbox/firmware/export/piezo.h	2006-07-24 17:41:51.000000000 +0200
@@ -0,0 +1,6 @@
+void piezo_init(void);
+void piezo_play(int inv_freq);
+void piezo_play_for(int inv_freq, int dur);
+void piezo_stop(void);
+void piezo_clear(void);
+bool piezo_busy(void);
diff -Nru rockbox-allOrig/firmware/SOURCES rockbox/firmware/SOURCES
--- rockbox-allOrig/firmware/SOURCES	2006-07-21 17:56:25.000000000 +0200
+++ rockbox/firmware/SOURCES	2006-07-24 17:43:24.000000000 +0200
@@ -209,6 +209,9 @@
 #if CONFIG_USBOTG == USBOTG_M5636
 drivers/m5636.c
 #endif
+#ifdef HAVE_PIEZO
+drivers/piezo.c
+#endif
 
 #ifdef IAUDIO_X5
 target/coldfire/iaudio/x5/power-x5.c

