Merge branch 'develop' into hack-lenovo
This commit is contained in:
commit
13392b5125
@ -13,12 +13,12 @@ src_install:
|
|||||||
sed 's/#MODULE_VERSION#/$(modver)/' dkms/dkms.conf > '$(DKMS_DEST)/dkms.conf'
|
sed 's/#MODULE_VERSION#/$(modver)/' dkms/dkms.conf > '$(DKMS_DEST)/dkms.conf'
|
||||||
|
|
||||||
build: src_install
|
build: src_install
|
||||||
$(DKMS) build 'bbswitch/$(modver)'
|
$(DKMS) build -m bbswitch -v $(modver)
|
||||||
|
|
||||||
install: build
|
install: build
|
||||||
$(DKMS) install 'bbswitch/$(modver)'
|
$(DKMS) install -m bbswitch -v $(modver)
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
$(DKMS) remove bbswitch/$(modver) --all
|
$(DKMS) remove -m bbswitch -v $(modver) --all
|
||||||
|
|
||||||
.PHONY: all src_install build install uninstall
|
.PHONY: all src_install build install uninstall
|
||||||
|
10
NEWS
10
NEWS
@ -1,3 +1,13 @@
|
|||||||
|
* Improved compatibility with older DKMS versions.
|
||||||
|
|
||||||
|
Version 0.4.2 - 26 April 2012
|
||||||
|
|
||||||
|
* Fixed a documentation error on unload_state.
|
||||||
|
* Added Makefile.dkms and documentation for easier installation using DKMS.
|
||||||
|
* Make /proc/acpi/bbswitch world-writable
|
||||||
|
* Fix NULL pointer dereference when reporting a failure during ACPI method
|
||||||
|
evaluation.
|
||||||
|
|
||||||
Version 0.4.1 - 16 January 2012
|
Version 0.4.1 - 16 January 2012
|
||||||
|
|
||||||
* Corrected a small error that yielded an confusing error message "The discrete
|
* Corrected a small error that yielded an confusing error message "The discrete
|
||||||
|
@ -40,8 +40,8 @@ DKMS support
|
|||||||
|
|
||||||
If you have DKMS installed, you can install bbswitch in such a way that it
|
If you have DKMS installed, you can install bbswitch in such a way that it
|
||||||
survives kernel upgrades. It is recommended to remove older versions of bbswitch
|
survives kernel upgrades. It is recommended to remove older versions of bbswitch
|
||||||
by running `dkms remove bbswitch/OLDVERSION --all` as root. To install the new
|
by running `dkms remove -m bbswitch -v OLDVERSION --all` as root. To install
|
||||||
version, simply run:
|
the new version, simply run:
|
||||||
|
|
||||||
# make -f Makefile.dkms
|
# make -f Makefile.dkms
|
||||||
|
|
||||||
@ -116,7 +116,7 @@ The module has some options that control the behavior on loading and unloading:
|
|||||||
`load_state` and `unload_state`. Valid values are `-1`, `0` and `1` meaning "do
|
`load_state` and `unload_state`. Valid values are `-1`, `0` and `1` meaning "do
|
||||||
not change the card state", "turn the card off" and "turn the card on"
|
not change the card state", "turn the card off" and "turn the card on"
|
||||||
respectively. For example, if you want to have `bbswitch` disable the card
|
respectively. For example, if you want to have `bbswitch` disable the card
|
||||||
immediately when loading the module while disabling the card on unload, load the
|
immediately when loading the module while enabling the card on unload, load the
|
||||||
module with:
|
module with:
|
||||||
|
|
||||||
# modprobe bbswitch load_state=0 unload_state=1
|
# modprobe bbswitch load_state=0 unload_state=1
|
||||||
|
18
bbswitch.c
18
bbswitch.c
@ -16,7 +16,7 @@
|
|||||||
#include <linux/suspend.h>
|
#include <linux/suspend.h>
|
||||||
#include <linux/seq_file.h>
|
#include <linux/seq_file.h>
|
||||||
|
|
||||||
#define BBSWITCH_VERSION "0.4.1"
|
#define BBSWITCH_VERSION "0.4.2"
|
||||||
|
|
||||||
MODULE_LICENSE("GPL");
|
MODULE_LICENSE("GPL");
|
||||||
MODULE_DESCRIPTION("Toggle the discrete graphics card");
|
MODULE_DESCRIPTION("Toggle the discrete graphics card");
|
||||||
@ -71,12 +71,11 @@ static struct notifier_block nb;
|
|||||||
/* whether the card was off before suspend or not; on: 0, off: 1 */
|
/* whether the card was off before suspend or not; on: 0, off: 1 */
|
||||||
int dis_before_suspend_disabled;
|
int dis_before_suspend_disabled;
|
||||||
|
|
||||||
static char *buffer_to_string(const char buffer[], char *target) {
|
static char *buffer_to_string(const char *buffer, size_t n, char *target) {
|
||||||
int i;
|
int i;
|
||||||
for (i=0; i<sizeof(buffer); i++) {
|
for (i=0; i<n; i++) {
|
||||||
sprintf(target + i * 5, "%02X,", buffer[i]);
|
snprintf(target + i * 5, 5 * (n - i), "0x%02X,", buffer ? buffer[i] & 0xFF : 0);
|
||||||
}
|
}
|
||||||
target[sizeof(buffer) * 5] = '\0';
|
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,12 +111,13 @@ static int acpi_call_dsm(acpi_handle handle, const char muid[16], int revid,
|
|||||||
|
|
||||||
err = acpi_evaluate_object(handle, "_DSM", &input, &output);
|
err = acpi_evaluate_object(handle, "_DSM", &input, &output);
|
||||||
if (err) {
|
if (err) {
|
||||||
char tmp[5 * max(sizeof(muid), sizeof(args))];
|
char muid_str[5 * 16];
|
||||||
|
char args_str[5 * 4];
|
||||||
|
|
||||||
printk(KERN_WARNING "bbswitch: failed to evaluate _DSM {%s} %X %X"
|
printk(KERN_WARNING "bbswitch: failed to evaluate _DSM {%s} 0x%X 0x%X"
|
||||||
" {%s}: %s\n",
|
" {%s}: %s\n",
|
||||||
buffer_to_string(muid, tmp), revid, func,
|
buffer_to_string(muid, 16, muid_str), revid, func,
|
||||||
buffer_to_string(args, tmp), acpi_format_exception(err));
|
buffer_to_string(args, 4, args_str), acpi_format_exception(err));
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user