Comment

Comment by freewizard

Nice project.

I wrote sth similar for myself, without requirement of USB switch or other hardware. it sends DDC command to HDMI/USB-C monitor and HID++ byte code to Logi MX keyboard and mouse.

Code is too messy to share but here's snippet if anyone want to write their own:

    hid_devices = [
        {
            'name': 'Logi Bolt Receiver',
            'receivers': hid.enumerate(0x046D, 0xC548),
            'command': [  # MX Keys Mini as first device on the receiver
                bytes([0x11, 0x01, 0x09, 0x1A, 0x00] + [0] * 15),  # change host to 1
                bytes([0x11, 0x01, 0x09, 0x1F, 0x01] + [0] * 15),  # change host to 2
                bytes([0x11, 0x01, 0x09, 0x1D, 0x02] + [0] * 15)]  # change host to 3
        }, {
            'name': 'Logitech Unified Receiver',
            'receivers': hid.enumerate(0x046D, 0xC52B),
            'command': [  # MX Anywhere 3 as first device on the receiver
                bytes([0x11, 0x01, 0x0A, 0x1A, 0x00] + [0] * 15),  # change host to 1
                bytes([0x11, 0x01, 0x0A, 0x1E, 0x01] + [0] * 15),  # change host to 2
                bytes([0x11, 0x01, 0x0A, 0x19, 0x02] + [0] * 15)]  # change host to 3
        }, {
            'name': 'MX Keys Mini Bluetooth',
            'receivers': hid.enumerate(0x046D, 0xB36E),
            'command': [
                bytes([0x11, 0xFF, 0x09, 0x1E, 0x00] + [0] * 15),  # change host to 1
                bytes([0x11, 0x01, 0x09, 0x1F, 0x01] + [0] * 15),  # change host to 2
                bytes([0x11, 0xFF, 0x09, 0x1D, 0x02] + [0] * 15)]  # change host to 3
        }, {
            'name': 'MX Anywhere 3 Bluetooth',
            'receivers': hid.enumerate(0x046D, 0xB025),
            'command': [
                bytes([0x11, 0xFF, 0x0A, 0x1A, 0x00] + [0] * 15),  # change host to 1
                bytes([0x11, 0x01, 0x0A, 0x1E, 0x01] + [0] * 15),  # change host to 2
                bytes([0x11, 0xFF, 0x0A, 0x19, 0x02] + [0] * 15)]  # change host to 3
        }
    ]
parent freewizard 2 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton