{"id":20339913,"url":"https://github.com/uditkarode/bbswitch","last_synced_at":"2026-06-04T02:31:12.817Z","repository":{"id":107554214,"uuid":"352322545","full_name":"uditkarode/bbswitch","owner":"uditkarode","description":"Didn't wanna waste time looking for a way to disable Werror so I just fixed the warnings instead","archived":false,"fork":false,"pushed_at":"2021-03-28T12:25:38.000Z","size":75,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-14T18:08:41.772Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/uditkarode.png","metadata":{"files":{"readme":"README.md","changelog":"NEWS","contributing":null,"funding":null,"license":"COPYING","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,"publiccode":null,"codemeta":null}},"created_at":"2021-03-28T12:24:57.000Z","updated_at":"2021-03-28T12:25:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"fa74a780-815b-4c3d-8ffd-e7f0d2ac78ac","html_url":"https://github.com/uditkarode/bbswitch","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uditkarode%2Fbbswitch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uditkarode%2Fbbswitch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uditkarode%2Fbbswitch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uditkarode%2Fbbswitch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uditkarode","download_url":"https://codeload.github.com/uditkarode/bbswitch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241867649,"owners_count":20033815,"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-14T21:19:00.040Z","updated_at":"2026-06-04T02:31:12.811Z","avatar_url":"https://github.com/uditkarode.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"*Migrated from https://github.com/Lekensteyn/acpi-stuff*\n\nAbout\n-----\n\nbbswitch is a kernel module which automatically detects the required ACPI calls\nfor two kinds of Optimus laptops. It has been verified to work with \"real\"\nOptimus and \"legacy\" Optimus laptops (at least, that is how I call them). The\nmachines on which these tests has performed are:\n\n- Clevo B7130 - GT 425M (\"real\" Optimus, Lekensteyns laptop)\n- Dell Vostro 3500 - GT 310M (\"legacy\" Optimus, Samsagax' laptop)\n\n(note: there is no need to add more supported laptops here as the universal\ncalls should work for every laptop model supporting either Optimus calls)\n\nIt's preferred over manually hacking with the acpi_call module because it can\ndetect the correct handle preceding _DSM and has some built-in safeguards:\n\n- You're not allowed to disable a card if a driver (nouveau, nvidia) is loaded.\n- Before suspend, the card is automatically enabled. When resuming, it's\n  disabled again if that was the case before suspending. Hibernation should\n  work, but it not tested.\n\nPrecautionary measure : \n- On some machines, turning off the card is permanent and the card does not\n  reappear on subsequents reboots, which can result into the screen staying\n  black all the time, including the BIOS screen.\n  If it occurs, first try to shutdown, unplug power cord, remove battery, wait\n  30s, then put everything back in and boot. If it's not solved, then the\n  solution is to reset the BIOS to factory settings. Before executing bbswitch\n  for the first time, it is therefore recommended to take note of the full key\n  sequence in the BIOS to do a reset. \n\nBuild\n-----\n\nBuild the module (kernel headers are required):\n\n    make\nThen load it (requires root privileges, i.e. `sudo`):\n\n    make load\nIf your card is supported, there should be no error. Otherwise, you get a \"No\nsuch device\" (ENODEV) error. Check your kernel log (dmesg) for more\ninformation.\n\nDKMS support\n------------\n\nIf you have DKMS installed, you can install bbswitch in such a way that it\nsurvives kernel upgrades. It is recommended to remove older versions of bbswitch\nby running `dkms remove -m bbswitch -v OLDVERSION --all` as root. To install\nthe new version, simply run:\n\n    # make -f Makefile.dkms\n\nTo uninstall it, run:\n\n    # make -f Makefile.dkms uninstall\n\nUsage\n-----\n\nbbswitch has three commands to check the card status and switching \n(`#` means \"run with root privileges, i.e. run it prefixed with `sudo `):\n\n### Get the status:\n\n    # cat /proc/acpi/bbswitch  \n    0000:01:00.0 ON\n\n### Turn the card off, respectively on:\n\n    # tee /proc/acpi/bbswitch \u003c\u003c\u003cOFF\n    # tee /proc/acpi/bbswitch \u003c\u003c\u003cON\nIf the card stays on when trying to disable it, you've probably forgotten to\nunload the driver,\n\n    $ dmesg |tail -1\n    bbswitch: device 0000:01:00.0 is in use by driver 'nouveau', refusing OFF\n\nDo **not** attempt to load a driver while the card is off or the card won't be\nusable until the PCI configuration space has been recovered (for example, after\nwriting the contents manually or rebooting).\n\n### Module options\n\nThe module has some options that control the behavior on loading and unloading:\n`load_state` and `unload_state`. Valid values are `-1`, `0` and `1` meaning \"do\nnot change the card state\", \"turn the card off\" and \"turn the card on\"\nrespectively. For example, if you want to have `bbswitch` disable the card\nimmediately when loading the module while enabling the card on unload, load the\nmodule with:\n\n    # modprobe bbswitch load_state=0 unload_state=1\n\nThe `unload_state` value can be changed on runtime, the above command yields the\nsame behavior as:\n\n    # modprobe bbswitch load_state=0\n    # echo 1 | tee /sys/module/bbswitch/parameters/unload_state\n\nIf not explictly set, the default behavior is not to change the power state of\nthe discrete video card which equals to `load_state=-1 unload_state=-1`.\n\nThe Lenovo T410 and Lenovo T410s laptops need the module option\n`skip_optimus_dsm=1`, otherwise it will detect the wrong methods which result in\nthe card not being disabled.\n\n### Disable card on boot\n\nThese options can be useful to disable the card on boot time. Depending on your\ndistribution, `/etc/modules`, `/etc/modules.conf` or some other file can be used\nto load modules on boot time. Adding the below line to the file makes the card\nget disabled on boot:\n\n    bbswitch load_state=0\n\nUsers of `kmod` should create `/etc/modprobe.d/bbswitch.conf` containing\n`options bbswitch load_state=0` to set the default options. To load the module,\nsystemd users should create `/etc/modules-load.d/bbswitch.conf` containing\n`bbswitch`.\n\nYou have to update your initial ramdisk (initrd) for the changes propagate to\nthe boot process. On Debian and Ubuntu, this can performed by running\n`update-initramfs -u` as root.\n\n### Enable card on shutdown\n\nSome machines do not like the card being disabled at shutdown.  \nAdd the next initscript (`/etc/init/bbswitch.conf`) :\n\n    description \"Save power by disabling nvidia on Optimus\"\n    author      \"Lekensteyn \u003clekensteyn@gmail.com\u003e\"\n    start on    runlevel [2345]\n    stop on     runlevel [016]\n    pre-start   exec /sbin/modprobe bbswitch load_state=0 unload_state=1\n    pre-stop    exec /sbin/rmmod bbswitch \n\nReporting bugs\n--------------\n\nThis module has been integrated in Bumblebee \"Tumbleweed\". Please report any\nissues on this module in the issue tracker and provide the following details:\n\n- The output of `dmesg | grep -C 10 bbswitch:`\n- The kernel version `uname -a`\n- Your distribution and version (if applicable)\n- The version of your Xorg and the driver\n- Submit your machine information on https://bugs.launchpad.net/bugs/752542;\n  the instructions are listed in the bug description. Summary: install the\n  packages containing `dmidecode`, `acpidump` and `iasl` and then run:\n\n        wget http://lekensteyn.nl/files/get-acpi-info.sh\n        sh get-acpi-info.sh\n- Information about the ACPI handles associated with PCI devices. Since this is\n  a kernel module, you'll need kernel headers, gcc and automake. Commands:\n\n        git clone git://github.com/Lekensteyn/acpi-stuff.git --depth 1\n        cd acpi-stuff/acpi_dump_info\n        make\n        sudo make load\n        cat /proc/acpi/dump_info\n\nUpload the generated tarball on the above Launchpad URL and provide a link to\nthe comment containing your report.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuditkarode%2Fbbswitch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuditkarode%2Fbbswitch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuditkarode%2Fbbswitch/lists"}