# HG changeset patch # User Michael Pavone # Date 1552281092 25200 # Node ID fc9bea5ee07954c49b72a061bf335953a8810295 # Parent 3a8c4ee685687680f529b4ad1138a8751284cac2 Fix off-by-one error in evdev init code and allow ALSA device to be specified in config diff -r 3a8c4ee68568 -r fc9bea5ee079 render_fbdev.c --- a/render_fbdev.c Sun Mar 10 21:30:09 2019 -0700 +++ b/render_fbdev.c Sun Mar 10 22:11:32 2019 -0700 @@ -943,7 +943,8 @@ static void init_audio() { - int res = snd_pcm_open(&audio_handle, "default", SND_PCM_STREAM_PLAYBACK, 0); + char *device_name = tern_find_path_default(config, "audio\0alsa_device\0", (tern_val){.ptrval="default"}, TVAL_PTR).ptrval; + int res = snd_pcm_open(&audio_handle, device_name, SND_PCM_STREAM_PLAYBACK, 0); if (res < 0) { fatal_error("Failed to open ALSA device: %s\n", snd_strerror(res)); } @@ -1364,7 +1365,7 @@ } int to_check[] = {KEY_ENTER, BTN_MOUSE, BTN_GAMEPAD}; device_type dtype = DEV_NONE; - for (int i = 0; i < 4; i++) + for (int i = 0; i < 3; i++) { if (1 & button_bits[to_check[i]/(8*sizeof(button_bits[0]))] >> to_check[i]%(8*sizeof(button_bits[0]))) { dtype = i + 1;