Added support of bluetooth remote G20BTS PRO to my Volumio on RPI4

try if this does the trick. Just a guess as I don’t have the hardware.

while True:
    dev_list_file = open(dev_list_filename, 'r')

    dev_found = False
    infile_path = "/dev/input/"
    for line in dev_list_file:
        if '=' in line:
            tokens = line.split('=')
            if  'G20BTS Keyboard' in tokens[1]:
                dev_found = True
            if dev_found and 'Handlers' in tokens[0]:
                tokens = tokens[1].split(' ')
                infile_path = infile_path + tokens[3]
                break

    dev_list_file.close()
    if dev_found:
        EVENT_SIZE = struct.calcsize("llHHIllHHIllHHI")
        file = open(infile_path, "rb")
        event = file.read(EVENT_SIZE)
        pressed = -1
        while event:
            (tv_sec1, tv_usec1, type1, code1, value1, tv_sec2, tv_usec2, type2, code2, value2, tv_sec2, tv_usec3, type3, code3, value3) = struct.unpack("llHHIllHHIllHHI", event)
            if pressed == -1:
                pressed = value1

                url = ''

                if value1 == 786666:
                    url=URL + 'volume&volume=minus'
                elif value1 == 786665:
                    url=URL + 'volume&volume=plus'
                elif value1 == 786637:
                    url = URL + 'toggle'
                elif value1 == 786658:
                    url = URL + 'volume&volume=toggle'
                elif value1 == 786614:
                    url = URL + 'prev'
                elif value1 == 786613:
                    url = URL + 'next'
                if len(url) > 0:
                    try:
                        requests.get(url=url, timeout=0.000000001)
                    except requests.exceptions.ReadTimeout:
                        pass
            elif pressed == value1:
                pressed = -1
            event = file.read(EVENT_SIZE)
    else:
        time.sleep(1)