{"id":21380821,"url":"https://github.com/frameworkcomputer/dgpu-power-state-linux","last_synced_at":"2025-03-16T10:43:05.713Z","repository":{"id":222567695,"uuid":"757769565","full_name":"FrameworkComputer/dgpu-power-state-linux","owner":"FrameworkComputer","description":"A simple pyudev script to detect if the dGPU is in low power state or not.","archived":false,"fork":false,"pushed_at":"2024-02-15T02:34:37.000Z","size":97,"stargazers_count":2,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-09T03:05:36.568Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FrameworkComputer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-02-14T23:53:07.000Z","updated_at":"2024-10-26T13:18:14.000Z","dependencies_parsed_at":"2024-02-15T00:47:04.104Z","dependency_job_id":null,"html_url":"https://github.com/FrameworkComputer/dgpu-power-state-linux","commit_stats":null,"previous_names":["frameworkcomputer/dgpu-power-state-linux"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FrameworkComputer%2Fdgpu-power-state-linux","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FrameworkComputer%2Fdgpu-power-state-linux/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FrameworkComputer%2Fdgpu-power-state-linux/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FrameworkComputer%2Fdgpu-power-state-linux/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FrameworkComputer","download_url":"https://codeload.github.com/FrameworkComputer/dgpu-power-state-linux/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243857996,"owners_count":20359259,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-22T10:42:52.058Z","updated_at":"2025-03-16T10:43:05.689Z","avatar_url":"https://github.com/FrameworkComputer.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dgpu-power-state-linux\nA simple pyudev script to detect if the dGPU is in low power state or not for the Framework Laptop 16; with dGPU attached.\n\n## Considerations\n\n- You need to pip install pyudev.\n- Card 1 is assumed to be dGPU, card 2 is assumed to be UMA...change to meet your own needs.\n(This can be edited into whatever you like, see below for section you can tweak to meet your needs - but uneeded for Framework Laptop 16 with dGPU.)\n\nBelow is code I found is correct **for a recent Ubuntu LTS install** - note **card 0 and card 1** in this case.\n```\ncontext = Context()\nfor device in context.list_devices(subsystem='drm', DEVTYPE='drm_minor'):\n    # Attempt to dynamically determine which DRM devices correspond to UMA and dGPU\n    if 'card0' in device.sys_path:\n        cards['dGPU'] = device.sys_path.split('/')[-1]\n    elif 'card1' in device.sys_path:\n        cards['UMA'] = device.sys_path.split('/')[-1]\n```\n\n- Data pulled from /sys/class/drm/ giving us event specific driven data.\n\n## Features\n\n- Lists power control as On/Off/Auto.\n- Vendor/Device data.\n- uevent driver.\n- Time suspended and active.\n\n## Requirements\n\n### Fedora\n\n```\nsudo dnf install git pip -y \u0026\u0026 pip install pyudev\n```\n\n### Ubuntu LTS\n\n```\nsudo apt update \u0026\u0026 sudo apt install git pip -y \u0026\u0026 pip install pyudev\n```\n\n## Run the script\n\n#### Run the script in a terminal as follows for Fedora\n\n```\ngit clone https://github.com/FrameworkComputer/dgpu-power-state-linux.git \u0026\u0026 cd dgpu-power-state-linux \u0026\u0026 python3 gpu-power-state-Fedora.py\n```\n\n#### Run the script in a terminal as follows for Ubuntu LTS\n\n```\ngit clone https://github.com/FrameworkComputer/dgpu-power-state-linux.git \u0026\u0026 cd dgpu-power-state-linux \u0026\u0026 python3 gpu-power-state-Ubuntu.py\n```\n\n![Power state for dGPU](https://raw.githubusercontent.com/FrameworkComputer/dgpu-power-state-linux/main/dgpu-uma.png \"Power state for dGPU\")\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fframeworkcomputer%2Fdgpu-power-state-linux","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fframeworkcomputer%2Fdgpu-power-state-linux","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fframeworkcomputer%2Fdgpu-power-state-linux/lists"}