No, I was wrong...
the idea was to predeclare static int_scanmap_simple[] which was defined at the 
end...
Seems the correct way (maybe making an extern declaration would have work) 
is/was to move it at the beginning of the file:

paul@jacko:~/myhelenos/HelenOS/uspace/srv/hid/input/ctl$ git --no-pager log -p 
-1 --no-color
commit 5fbdbf9756c10975e5838ef599ebb8afcb35e8c6 (HEAD -> master)
Author: Paul Dufresne <[email protected]>
Date:   Thu Feb 11 20:46:20 2021 -0500

    move the array initialization at the beginning of the file

diff --git a/uspace/srv/hid/input/ctl/sun.c b/uspace/srv/hid/input/ctl/sun.c
index a2d5113b1..ae3e7bb8e 100644
--- a/uspace/srv/hid/input/ctl/sun.c
+++ b/uspace/srv/hid/input/ctl/sun.c
@@ -57,43 +57,6 @@ static kbd_dev_t *kbd_dev;
 #define KBD_KEY_RELEASE                0x80
 #define KBD_ALL_KEYS_UP                0x7f
 
-static int scanmap_simple[256]; // maybe 0x80 would have been enough
-
-static errno_t sun_ctl_init(kbd_dev_t *kdev)
-{
-       kbd_dev = kdev;
-       return 0;
-}
-
-static void sun_ctl_parse(sysarg_t scancode)
-{
-       kbd_event_type_t type;
-       unsigned int key;
-
-       if (scancode >= 0x100)
-               return;
-
-       if (scancode == KBD_ALL_KEYS_UP)
-               return;
-
-       if (scancode & KBD_KEY_RELEASE) {
-               scancode &= ~KBD_KEY_RELEASE;
-               type = KEY_RELEASE;
-       } else {
-               type = KEY_PRESS;
-       }
-
-       key = scanmap_simple[scancode];
-       if (key != 0)
-               kbd_push_event(kbd_dev, type, key);
-}
-
-static void sun_ctl_set_ind(kbd_dev_t *kdev, unsigned mods)
-{
-       (void) mods;
-}
-
-/** Primary meaning of scancodes. */
 static int scanmap_simple[] = {
        [0x00] = 0,
        [0x01] = 0,
@@ -225,5 +188,40 @@ static int scanmap_simple[] = {
        [0x7f] = 0
 };
 
+static errno_t sun_ctl_init(kbd_dev_t *kdev)
+{
+       kbd_dev = kdev;
+       return 0;
+}
+
+static void sun_ctl_parse(sysarg_t scancode)
+{
+       kbd_event_type_t type;
+       unsigned int key;
+
+       if (scancode >= 0x100)
+               return;
+
+       if (scancode == KBD_ALL_KEYS_UP)
+               return;
+
+       if (scancode & KBD_KEY_RELEASE) {
+               scancode &= ~KBD_KEY_RELEASE;
+               type = KEY_RELEASE;
+       } else {
+               type = KEY_PRESS;
+       }
+
+       key = scanmap_simple[scancode];
+       if (key != 0)
+               kbd_push_event(kbd_dev, type, key);
+}
+
+static void sun_ctl_set_ind(kbd_dev_t *kdev, unsigned mods)
+{
+       (void) mods;
+}
+
+
 /** @}
  */

=================================================
paul@jacko:~/myhelenos/HelenOS/uspace/srv/hid/input/ctl$ 

the patch looks weird (moving the functions after the array rather than moving 
the array...) but I guess, it is ok.

_______________________________________________
HelenOS-devel mailing list
[email protected]
http://lists.modry.cz/listinfo/helenos-devel

Reply via email to