my new mk770 keyboard

I’ve indulged myself with a new keyboard, the Cooler Master MK770 mechanical keyboard in shades of gray and black. It seems this keyboard has attracted quite a bit of on-line positive coverage. What finally sold me to make the purchase is that it’s a Black Friday sale item for $71. I figured for that price I could give it a try, and if I didn’t like it I could return it.

I ordered on Saturday and it was delivered by Sunday. I’ve spent the last few days learning how to use it and how to ‘program’ the back light colors. I must say I greatly appreciate the feel of the mechanical keys. I also appreciate how heavy and solid the keyboard is. I haven’t felt this kind of keyboard since the late 1970s and early 1980s. That’s when I used IBM keyboards in the IBM ‘moosehead’ terminals at the First National Bank of Atlanta, and the nearly identical keyboards on the original IBM PC and IBM XT personal computers. I’d forgotten how nice such keys were for long periods of typing.

So far I’ve managed to configure the colors using keyboard chording with the function key (the key at the bottom with the Cooler Master logo on it) and other regular keys. It’s a nice light green color.

I’m still getting used to how the arrow keys are positioned on the keyboard. I keep sending the cursor off in unintended directions.

One excellent feature of this keyboard is how it helps and enhances my touch typing. I thought I’d forgotten how, but within an hour of setting up the keyboard I’ve been touch typing like a maniac.

Finally, I’m using the USB-C cable to connect to my Linux system. The cable isn’t all that intrusive.

I never thought I’d get excited over a keyboard, but I am about the MK770. Highly recommended.

going back to go

My mind appears unable to fully embrace how Rust is meant to be idiomatically used. I guess I’m too old. I’ve gone back to the Go language and discovered, once again, that it’s excellent at easily expressing complex ideas in code and having that code execute the way I expect. I see myself going back to Go over Rust and C++, and using Python in its MicroPython variant for embedded development. For software I write for others, I want a language that wraps everything up into a single binary executable that doesn’t require special support libraries be installed along side it. I can produce these types of binaries with C++, Go, and Rust. Python is complete on embedded devices, which is why I now do heavy development using MicroPython.

For this post I’ve written my devices listing application in Go, which I’ve previously written in Python, C++, and Rust. Here’s the Go listing.

package mainimport (  "errors"  "fmt"  "log"  "os"  "path/filepath"  "strings"  "encoding/json")func main() {  executable, error := os.Executable()  if error != nil {log.Fatal(error)  }  var annotations = make(map[string]string)  jsonPath := filepath.Dir(executable) + "/devices.json"  rawJSON, error := os.ReadFile(jsonPath)  if errors.Is(error, os.ErrNotExist) {fmt.Println("Annotations JSON file not found at:", jsonPath)  } else {json.Unmarshal(rawJSON, &annotations)  }  deviceById := "/dev/serial/by-id/"  files, error := os.ReadDir(deviceById)  if error != nil {log.Fatal(error)  }  for _, file := range files {symlink, _ := filepath.EvalSymlinks(deviceById + file.Name())device := filepath.Base(symlink)suffix := file.Name()[strings.LastIndex(file.Name(), "_")+1:]hexid := strings.Split(suffix, "-")[0]annotation, found := annotations[hexid]if found == true {  fmt.Println(device, "  ", annotation)} else {  fmt.Println(device, "  ", hexid)}  }}

Here’s a typical output. In this example I have three boards plugged into my Linux system, an ESP32-S3, an ESP32-C3, and a Raspberry Pi Pico 2:

ttyACM0Raspberry Pi Pico 2 - MicroPython 1.24.0 - RP2-EC93ttyUSB1ESP32-C3-DevKitC-1-N4 - ESP-IDF 5.3.1 DisplaysttyUSB0ESP32-S3-DevKitC-1.1-N32R8 - MicroPython-1.25.0-preview-xtensa-IDFv5.2.2 2024-11-08 - ESP32S3-7814

You can see the application’s found them all and their associated TTY port. This is quite useful when using command-line tools to communicated with them individually.

And finally, here’s a section of the JSON file the application reads in in order to match annotations with devices I have plugged in:

{  ...  "7a1c74c68740ec93": "Raspberry Pi Pico 2 - MicroPython 1.24.0 - RP2-EC93",  "7eab1642dbfaeb1198773ca4c6d924ec": "ESP32-C3-DevKitC-1-N4 - ESP-IDF 5.3.1 Displays",  "cc2ba0cbe2cfec11973d262686bdcd52": "ESP32-S3-DevKitC-1.1-N32R8 - MicroPython-1.25.0-preview-xtensa-IDFv5.2.2 2024-11-08 - ESP32S3-7814",  ...}

Quick Operational Description.

Here’s a bulleted list of what I’m trying to accomplish with the Go code.

  1. When started, determine where in the file system we were started (lines 14 and 18).
  2. With that file path, append our annotations file name to it so we can open it (lines 20 through 28). Note that the annotations file is in JSON.
  3. If the annotations file exists, read it in and unmarshal it as a map. If the file doesn’t exist, emit a message saying it couldn’t be found and where it is supposed to be located.
  4. Look for any devices plugged into the Linux system (line 31).
  5. Assuming you find any devices, extract the hex ID from each device name found (lines 38 through 42). Those hex IDs are unique.
  6. Try to look up the hex ID in the dictionary you loaded in step 3. If you find an entry, that’s your annotation. Print it out with the device you found in line 41. If there is no entry then print the device with the raw hex ID.

That’s basically it.

Final Thoughts

Life is way too short for me these days. I still like to write software, but now I want a language and supporting tools that make my efforts far more efficient. Go gives me all of that, and more. I started with Go over ten years ago (you can search for my entries in this blog) on very early Raspberry Pis, specifically the 3 and 4. Then I just sort of let it fade away while chasing other new and shiny languages like Rust. Now I’ve come back to Go for good, and will continue to use it for my purposes until I can no longer think in code, let alone write it.