import os

usb_path = "/sys/bus/usb/devices"


def get():
    usb_vendors = []
    for root, dirs, files in os.walk(usb_path):
        for usb_dir in dirs:
            vendor_file = os.path.join(root, usb_dir, "idVendor")
            product_file = os.path.join(root, usb_dir, "idProduct")
            vendor_id = None
            product_id = None
            if os.path.isfile(vendor_file):
                with open(vendor_file, "r") as f:
                    vendor_id = f.readline().strip().upper()
            if os.path.isfile(product_file):
                with open(product_file, "r") as f:
                    product_id = f.readline().strip().upper()
            if vendor_id and product_id:
                usb_vendors.append(f"{vendor_id}:{product_id}")

    return usb_vendors
