uConsole: Volume / Mute button?

Hi there,

I noted that on the uConsole there is a button above the “6” key which has an orange “x” symbol as well as a volume icon with an up and down arrow. When pushing this button normally (without the 'fn key) I noted that it lowers the volume. If I use the ‘fn’ key, it mutes the audio. However, is there a way to raise the volume using this key? The up arrow makes me think there must be a way to do this, but maybe not?

try

fn + shift + volume key

Didn’t work on A-06 uConsole using system pre-flashed on TF card. Do I need upgrade system image?

it is not related to os image, it is related to keyboard firmware

if fn+shift+volume key did not work, maybe need to upgrade keyboard firmware

2 Likes

I can confirm that it is firmware related. Once I updated my firmware, pushing the button reduces the volume while Fn+button increases the volume.

fixed after updating keyboard firmware.
but Fn+Volume is volume up, not mute, which a bit of odd…

Do uConsole’s keyboard still using the same code of devterm? I may build a new firmware to accommodate my personal usage habits.

not the same

here is the code address

I noted this strange behavior as well. However, I’d rather have volume down and up over volume down and mute :smiley:

Hi, I came across the same issue!

My module is R-01.

When updating this flash, it says

unknow architecture,exiting...

Now, my device stays muted, I tried the alsamixer but failed, help :smiley:

#!/bin/bash

#set -e

architecture="unknow"
case $(uname -m) in
    x86_64) architecture="amd64" ;;
    armv7l)    dpkg --print-architecture | grep -q "arm64" && architecture="aarch64" || architecture="armhf" ;;
    arm)    dpkg --print-architecture | grep -q "arm64" && architecture="aarch64" || architecture="armhf" ;;
    aarch64) architecture="aarch64";;
esac


if [ $architecture = "unknow" ]; then
        echo "unknow architecture,exiting..."
        exit
fi

here is the flashing script code, as we can see ,it just check the architecture of device, nothing more

so the Mute problem is not related

Thanks, it seems that uconsole_keyboard_flash.tar.gz doesn’t apply to RISC-V archtecture.

One can unmute your device via alsamixergui :smiley:

1 Like

Now
re-download the uconsole_keyboard_flash.tar.gz

md5sum is

0ed78754e3b998d3e023b9568758a22f

now it has applied to RISC-V archtecture

welcome to have a try

I took the riscv64 bin files from Keyboard Update for R01
@comradecactus

OK, I tried modify keyboard’s firmware to make Shift+Volume=Volume Up and Fn+Volume=Mute.

Code seems working, except Volume up is not. I can see it’s sending keycode using showkey command.

@guu The volume up keycode is 115, volume down is 114, mute is 113, is this correct?

try with a normal keyboard to detect the right keycode ,with command like xev

but I’ve looked at the code

seems that ,I use enum to define

volume up,down, mute

enum SKEYS {
  _SELECT_KEY =0xe8,  //Joystick.button(n)
  _START_KEY,          //Joystick.button(n)
  _JOYSTICK_UP, //B1 //Joystick.Y()
  _JOYSTICK_DOWN,    //Joystick.Y()
  _JOYSTICK_LEFT,    //Joystick.X()
  _JOYSTICK_RIGHT,   //Joystick.X()  
  _JOYSTICK_A,       //Joystick.button(1)
  _JOYSTICK_B,       //Joystick.button(2)
  _JOYSTICK_X,       //Joystick.button(3)
  _JOYSTICK_Y,       //Joystick.button(4)
  _JOYSTICK_L,
  _JOYSTICK_R,
  _FN_KEY,
  _MOUSE_LEFT,    // Mouse.press(1)
  _MOUSE_MID,     // Mouse.press(2)
  _MOUSE_RIGHT,   // Mouse.press(3)

  _FN_BRIGHTNESS_UP, //USB Consumer brightness up https://github.com/torvalds/linux/blob/7fe10096c1508c7f033d34d0741809f8eecc1ed4/drivers/hid/hid-input.c#L903
  _FN_BRIGHTNESS_DOWN, //USB Consumer brightness down 

  _VOLUME_M,
  _VOLUME_P,
  _VOLUME_MUTE, //https://github.com/torvalds/linux/blob/7fe10096c1508c7f033d34d0741809f8eecc1ed4/drivers/hid/hid-input.c#L956
  _TRACKBALL_BTN,
  _FN_LOCK_KEYBOARD,
  _FN_LIGHT_KEYBOARD,
  _FN_SHIFT //FN+SHIFT,ready for more function key
};

I found the problem… keycode is correct, but any volume key cannot be pressed with shift!
To deal with it, I tried release shift key before sending press volume up, and it worked. :innocent:

Here is diff for my use case (volume key=volume down, Shift key+volume key=volume up, Fn key+volume key=mute)

I will make a fork of uconsole’s repo and make all these changes in it. If you like to merge it into official repo, I can make a PR.

diff --git a/Code/uconsole_keyboard/keymaps.ino b/Code/uconsole_keyboard/keymaps.ino
index 9a2a643..973658d 100644
--- a/Code/uconsole_keyboard/keymaps.ino
+++ b/Code/uconsole_keyboard/keymaps.ino
@@ -67,7 +67,7 @@ const uint16_t keyboard_maps[][MATRIX_KEYS] = {
   },
 
   [FN_LAYER] = {
-    _PRINT_KEY, _PAUSE_KEY, _VOLUME_P, '`', '[', ']', KEY_F11, KEY_F12, \
+    _PRINT_KEY, _PAUSE_KEY, _VOLUME_MUTE, '`', '[', ']', KEY_F11, KEY_F12, \
     KEY_F1, KEY_F2, KEY_F3, KEY_F4, KEY_F5, KEY_F6, KEY_F7, KEY_F8, \
     KEY_F9, KEY_F10, _FN_LOCK_KEYBOARD, KEY_CAPS_LOCK, EMP, EMP, EMP, EMP, \
     'q', 'w', 'e', 'r', 't', 'y', KEY_PAGE_UP, KEY_INSERT, \
@@ -251,18 +251,20 @@ void keyboard_action(DEVTERM*dv, uint8_t row, uint8_t col, uint8_t mode) {
 
     case _VOLUME_P: {
         if (mode == KEY_PRESSED) {
-          if (dv->Keyboard_state.sf_on > 0) {
-            dv->Consumer->press(HIDConsumer::MUTE);
-          } else {
-            dv->Consumer->press(HIDConsumer::VOLUME_UP);
-          }
+          dv->Consumer->press(HIDConsumer::VOLUME_UP);
         } else {
           keyboard_release(dv, addr, k);
         }
       } break;
     case _VOLUME_M: {
         if (mode == KEY_PRESSED) {
-          dv->Consumer->press(HIDConsumer::VOLUME_DOWN);
+          if (dv->Keyboard_state.sf_on > 0) {
+            dv->Keyboard->release(_LEFT_SHIFT_KEY);
+            dv->Keyboard->release(KEY_RIGHT_SHIFT);
+            dv->Consumer->press(HIDConsumer::VOLUME_UP);
+          } else {
+            dv->Consumer->press(HIDConsumer::VOLUME_DOWN);
+          }
         } else {
           keyboard_release(dv, addr, k);
         }
@@ -319,7 +321,6 @@ void keypad_release_core(DEVTERM*dv, uint16_t k) {
 
   switch (k) {
     case _FN_SHIFT:
-      dv->Keyboard_state.sf_on = 0;
       break;
     case _LEFT_SHIFT_KEY:
     case KEY_RIGHT_SHIFT:
@@ -327,6 +328,7 @@ void keypad_release_core(DEVTERM*dv, uint16_t k) {
         dv->Keyboard->release(k);
         dv->Keyboard_state.shift.begin = 0;
         dv->Keyboard_state.shift.time = 0;
+        dv->Keyboard_state.sf_on = 0;
       }
       break;
 
@@ -474,11 +476,7 @@ void keypad_action(DEVTERM*dv, uint8_t col, uint8_t mode) {
 
   switch (k) {
     case _FN_SHIFT:
-      if (mode == KEY_PRESSED) {
-        dv->Keyboard_state.sf_on = k;
-      } else {
         keypad_release(dv, col, k);
-      }
       break;
     case _LEFT_SHIFT_KEY:
     case KEY_RIGHT_SHIFT:
@@ -486,6 +484,7 @@ void keypad_action(DEVTERM*dv, uint8_t col, uint8_t mode) {
         if (dv->Keyboard_state.shift.lock == 0) {
           dv->Keyboard->press(k);
           dv->Keyboard_state.shift.begin = k;
+          dv->Keyboard_state.sf_on = k;
         }
       } else if (mode == KEY_RELEASED) {
         keypad_release(dv, col, k);

cool

give me the PR

I want to try it out