qmk / qmk_toolbox

A Toolbox companion for QMK Firmware
https://qmk.fm/toolbox
MIT License
2.66k stars 519 forks source link

Linux ever? #59

Closed MKUltraCorp closed 4 months ago

MKUltraCorp commented 5 years ago

Any plans to finish the coding for Linux? Anyone working on it or is it dead in the water?

BramVer commented 5 years ago

It seems pretty dead in the water, which is a shame since I've dropped my Windows machine, and none of the ways of 'flashing on Linux' seem to work for me.
I basically have to spin up a Windows VM for the sole purpose of flashing compiled .hex files onto controllers.

Having the qmk_toolbox run on Linux would be greatly appreciated.

scottAnselmo commented 5 years ago

I'm willing to throw a bounty on this via BountySource. Would need to know the desired amount though from @jackhumbert or someone reputable so I'm not just tossing money at something that gets locked up and nothing actually happens.

I too hate having to spin up a Windows VM or work laptop, and even then Windows drivers tend to be a bit buggy when flashing stuff it seems.

QuercusFelis commented 5 years ago

Any update on this? I can compile the linux code but the program itself is still unusable

drashna commented 4 years ago

Unfortunately, the linux version is basically just a shell. Unless somebody wants to work on the linux version, there won't be any progress.

AliceGrey commented 4 years ago

@sanecito I'd also be willing to chip in on BountySource if @jackhumbert or @fauxpark took this up.

jackhumbert commented 4 years ago

I do have a renewed interest in this now that early Pinephones are out there - getting something going on Ubuntu Touch would be pretty neat.

fauxpark commented 4 years ago

I'm not at all familiar with developing on Linux, much less a GUI application. From what I can tell, a Linux port would be kinda distro-specific, unless we used something like Electron? (I have no idea)

tzarc commented 4 years ago

Perhaps something like: https://github.com/zserge/webview/tree/webview-x

scottAnselmo commented 4 years ago

There shouldn't be a need to target only a specific distro. Without deep diving, odds are one could repurpose a decent amount of the C# code and switch to the Mono framework as needed. Looking at the Linux dir, if they wanted to continue along a C/C++ route for logic they could use either the GTK or Qt toolkits for GUI. Those two especially with recent advancements like libhandy for GTK are toolkits that are more polished and better lend themselves to adaptive UI which is needed to say, make a solid UX for apps on PinePhone, Librem5.

rkrhlikar commented 4 years ago

I recently created a fork where I took the Glade layout file and started implementing some of the logic behind it using gtkmm (the C++ gtk library), so it should work on different distros. I started with the low hanging fruit (meaning not touching anything related to hardware, which is, of course, the most important part) so as not to lose all motivation right out of the gate (working with HW is always a PITA :)). I expect to test flashing Pro Micros sometime this week.

As is often the case with these things, I make no promises about actually seeing this through. I decided to comment here, so that even if I do run out of steam, anyone interested in picking this up can do so without starting from scratch. As long as I do, however, keep working on it, I will be commenting with any significant progress I make in the near future (unless that would be considered spamming?).

rkrhlikar commented 4 years ago

As promised, a quick update: I made some progress on the hardware side of things. I was able to successfully flash firmware onto the Pro Micros on my Kyria keyboard using the GUI. That means that the current test implementation for Caterina devices is up and running.

I had some problems with avrdude on my computer which were resolved by stopping the ModemManager service on my Ubuntu 18.04 installation when flashing the Arduinos. This can be done by running sudo systemctl stop ModemManager.service. I found this fix on the Arduino forums (if anyone would like to get more details considering the issue).

Planned next steps:

Long(er)-term goals:

Erovia commented 4 years ago

@rkrhlikar if you need some testing, ping me on Discord!

NoraCodes commented 4 years ago

@rkrhlikar please let me know if you need any additional help with this. I'd love to see a QMK Toolbox working on Linux and I have some experience distributing GTK applications to different distros which could potentially be useful.

CharString commented 4 years ago

This is comment is just as a reference for some Linux user contemplating their first build and this issue might scare them.

I found the CLI experience of the firmware just really good. I installed toolbox, because it was step one in the manual that came with my pcb. But I ended up not using it. Somewhere along the way I switched to following the qmk newbie docs and used the CLI for everything. qmk setup even detected I was on Fedora at one time and Debian the other, and used their respective package managers to install the missing dependencies. For the first flash, qmk doctor and dmesg helped with seeing whether my board was in bootloader mode or not.

There's just one thing I did differently. As I do a lot of python development myself, I chose to use pipx as I do with all my python packages I just want to install for the CLI command they provide.

My guess to why no one has picked this issue up as something to work on, is that it doesn't really scratch a personal itch. That said, Vim is my editor of choice, Super+Space fires up a terminal window in my setup and I do have experience with Arduino. So your idea of a good experience might be different from mine. But as you're building your own keyboard... using CLI instead of GUI just gives you more use and gratification from your project.

jberryman commented 3 years ago

Has anyone managed to get it to run in wine? I've struck out there

malikbenkirane commented 2 years ago

@CharString your comment saved my time that should be merged to README.md :+1:

I mean guys! Who would approve the PR? I open one if I see some interest :heart:

brunzefb commented 1 year ago

I am actually thinking of taking a stab at this one using Avalonia.MVVM, since I know WPF. This is a .netcore6, so it will run on Linux if I don't use Windows-specific functionality. The primary UI (except for the keyboard tester) is pretty standard stuff, no fancy controls. The scary thing is the low-level USB connection, it look like the in normal mode, the keyboard uses the normal driver. When you reset the keyboard, it disconnects from USB, and reconnects with the ID of the MCU in the keyboard. If anyone as info or example source on low-level usb that can be used, let me know.

2022-12-26 Update: I found the excellent LibUsbDotNet, which takes the pain out of the low-level USB stuff. I have some questions about the existing QMK toolbox app:

namespace Examples { internal class ReadPolling { public static IUsbDevice? MyUsbDevice; public static UsbDeviceFinder MyUsbFinder = new UsbDeviceFinder(0x03eb, 0x2ff4);

    public static void Main(string[] args)
    {
        Error ec = Error.Success;
        Console.WriteLine("Waiting for connection");
        while (true)
        {
            using (UsbContext context = new UsbContext())
            {
                MyUsbDevice = (UsbDevice)context.Find(MyUsbFinder);
                if (MyUsbDevice == null)
                {
                    Thread.Sleep(500);
                    continue;
                }

                Console.WriteLine("Connected!");
                break;
            }
        }
    }
}

}


2022-12-26 Update 2:  I have completed the Avalonia (think WPF) of the [Linux QMK main UI.](http://blog.brunzema.com/wp-content/uploads/2022/12/QMK_LinuxUI.png)  It looks very familiar, here with design grids enalbed (this will be turned of in production)
brunzefb commented 1 year ago

2022-12-26-Update 2: I have made some progress with the Linux QMK Toolbox main UI, coding this using the Avalonia (WPF-like) framework, just because I worked with WPF a few years ago. It all came back pretty quickly. I'm not sure what the No HID Console devices connected is for, it seems to be a combobox. I took some care so that the resizing works in a similar way as it does on my mac. All the UI is still non-functional, so I have to hook things up.

brunzefb commented 1 year ago

2022-12-28 Update: More progress to report. The main UI mostly works now, here is a new screenshot. The back-end USB connection detection now works (with some things still not right). 2022-12-28 Update: Works on my machine... :-), Here the screenshot of a successful reprogram. More cleanup work is needed. Code is in my branch, is very early alpha quality.

brunzefb commented 1 year ago

2022-12-30: Update: More progress. The WinForms original UI and the Avalonia UI look almost identical now. I have added menus, shortcuts, and reworked the UI to make it very similar to the Windows version. Drag and drop files works on Windows, but not on Linux, although the code is identical. I learned more about the low-level usb library, which does provide notification for vid/pid combinations/ connect/disconnect events. The C example code looks straight forward, and the C# library imports all those methods and has callback/delegate types. The alternative is a 'lsusb' style poll detection. Right now, the code polls all the vid/pid combinations in sequence, which is slow. Its better to get the list of usb devices 3 or 4 times per second, and do a set difference to determine what has been added/removed. Changing the combo box background, checkbox size, the menu fontsize is not easy, one has to replace the entire control template (then you can do anything), but I don't think this is worth it.

brunzefb commented 1 year ago

2022-12-30 Update: The LibUsbDotNet was not giving me the names of the devices, given a PID/VID. Reason for this is that one must call Open() on the device, which gets more info, including the Vendor name. Now Open only works if you are root :(, but you can add an entry into /etc/udev/rules.d, and reload with udevadm (or reboot), but this also needs sudo :-(. But you can get info as non-root by running udevadm info /dev/bus/usb/[device], which has VID, PID, and names. This can be parsed... find /dev/bus/usb -name "*" -exec udevadm info {} \; will list all the info... lsusb -d vid:pid will also work.

The last mystery was RevisionBcd, as it is unfortunately called int the QMK source. The C usb driver code in libusb.h calls this bcdDevice. The DotNetLibUsb just calls it Device in UsbDeviceInfo.cs.

plovinicius commented 4 months ago

Any update on this?

brunzefb commented 4 months ago

Three does not seem to be much appetite for the project to consider my PR, and the code works on my Linux box...

On Sat, Jul 13, 2024, 14:09 Paulo Vinicius @.***> wrote:

Any update on this?

— Reply to this email directly, view it on GitHub https://github.com/qmk/qmk_toolbox/issues/59#issuecomment-2227035324, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADQ736UTT2EBZ2DHLIYADTZMFUMRAVCNFSM6AAAAABK2OWGEGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMRXGAZTKMZSGQ . You are receiving this because you commented.Message ID: @.***>

fauxpark commented 4 months ago

https://github.com/qmk/qmk_toolbox/pull/396#issuecomment-2136711691