mirror of
https://xff.cz/git/pinephone-keyboard
synced 2024-11-14 20:55:01 -05:00
Make kmap.h build more resilient
Building with missing php resulted in empty kmap.h
This commit is contained in:
parent
a1978d22ed
commit
af4009e3bf
2
Makefile
2
Makefile
@ -16,7 +16,7 @@ $(OUT)ppkb-usb-debugger: usb-debugger.c common.c
|
|||||||
|
|
||||||
$(OUT)kmap.h: keymaps/physical-map.txt keymaps/factory-keymap.txt
|
$(OUT)kmap.h: keymaps/physical-map.txt keymaps/factory-keymap.txt
|
||||||
@mkdir -p $(OUT)
|
@mkdir -p $(OUT)
|
||||||
php keymaps/map-to-c.php $^ > $@
|
php keymaps/map-to-c.php $^ $@
|
||||||
|
|
||||||
$(OUT)ppkb-i2c-inputd: i2c-inputd.c $(OUT)kmap.h common.c
|
$(OUT)ppkb-i2c-inputd: i2c-inputd.c $(OUT)kmap.h common.c
|
||||||
@mkdir -p $(OUT)
|
@mkdir -p $(OUT)
|
||||||
|
@ -20,9 +20,23 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
set_error_handler(function($severity, $message, $file, $line) {
|
||||||
|
if (!(error_reporting() & $severity))
|
||||||
|
return;
|
||||||
|
|
||||||
|
throw new ErrorException($message, 0, $severity, $file, $line);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (count($argv) != 4) {
|
||||||
|
echo "Usage: $argv[0] <physmap> <keymap> <output>\n";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
$pmap = file_get_contents($argv[1]);
|
$pmap = file_get_contents($argv[1]);
|
||||||
$kmap = file_get_contents($argv[2]);
|
$kmap = file_get_contents($argv[2]);
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
|
||||||
// high nibble = row, low nibble col
|
// high nibble = row, low nibble col
|
||||||
$el_phys_map = [];
|
$el_phys_map = [];
|
||||||
foreach (explode("\n", $pmap) as $ln) {
|
foreach (explode("\n", $pmap) as $ln) {
|
||||||
@ -100,3 +114,6 @@ function kmap_to_code($name, $map) {
|
|||||||
kmap_to_code("keymap_base", $phys_key_base);
|
kmap_to_code("keymap_base", $phys_key_base);
|
||||||
kmap_to_code("keymap_fn", $phys_key_fn);
|
kmap_to_code("keymap_fn", $phys_key_fn);
|
||||||
kmap_to_code("keymap_pine", $phys_key_pine);
|
kmap_to_code("keymap_pine", $phys_key_pine);
|
||||||
|
|
||||||
|
file_put_contents($argv[3], ob_get_contents());
|
||||||
|
ob_end_clean();
|
||||||
|
Loading…
Reference in New Issue
Block a user