- struct dirent *ent;
- int i, count = 0;
- char **mfilters;
- char buff[64];
- DIR *dir;
-
- dir = opendir("/etc/pandora/conf/dss_fir");
- if (dir == NULL) {
- perror("filter opendir");
- return;
- }
-
- while (1) {
- errno = 0;
- ent = readdir(dir);
- if (ent == NULL) {
- if (errno != 0)
- perror("readdir");
- break;
- }
-
- if (ent->d_type != DT_REG && ent->d_type != DT_LNK)
- continue;
-
- count++;
- }
-
- if (count == 0)
- return;
-
- mfilters = calloc(count + 1, sizeof(mfilters[0]));
- if (mfilters == NULL)
- return;
-
- rewinddir(dir);
- for (i = 0; (ent = readdir(dir)); ) {
- size_t len;
-
- if (ent->d_type != DT_REG && ent->d_type != DT_LNK)
- continue;
-
- len = strlen(ent->d_name);
-
- // skip pre-HF5 extra files
- if (len >= 3 && strcmp(ent->d_name + len - 3, "_v3") == 0)
- continue;
- if (len >= 3 && strcmp(ent->d_name + len - 3, "_v5") == 0)
- continue;
-
- // have to cut "_up_h" for pre-HF5
- if (len > 5 && strcmp(ent->d_name + len - 5, "_up_h") == 0)
- len -= 5;
-
- if (len > sizeof(buff) - 1)
- continue;
-
- strncpy(buff, ent->d_name, len);
- buff[len] = 0;
- mfilters[i] = strdup(buff);
- if (mfilters[i] != NULL)
- i++;
- }
- closedir(dir);
+ { KEY_UP, PBTN_UP },
+ { KEY_DOWN, PBTN_DOWN },
+ { KEY_LEFT, PBTN_LEFT },
+ { KEY_RIGHT, PBTN_RIGHT },
+ /* Pandora */
+ { KEY_END, PBTN_MOK },
+ { KEY_PAGEDOWN, PBTN_MBACK },
+ { KEY_HOME, PBTN_MA2 },
+ { KEY_PAGEUP, PBTN_MA3 },
+ { KEY_LEFTCTRL, PBTN_MENU },
+ { KEY_RIGHTSHIFT, PBTN_L },
+ { KEY_RIGHTCTRL, PBTN_R },
+ /* "normal" keyboards */
+ { KEY_ENTER, PBTN_MOK },
+ { KEY_ESC, PBTN_MBACK },
+ { KEY_SEMICOLON, PBTN_MA2 },
+ { KEY_APOSTROPHE, PBTN_MA3 },
+ { KEY_BACKSLASH, PBTN_MENU },
+ { KEY_LEFTBRACE, PBTN_L },
+ { KEY_RIGHTBRACE, PBTN_R },
+};