Hello,
I noticed (as in "my mouse stopped working") that the heuristic that
should skip USB input devices when enabling auto suspend is not working.
After staring at the code long enough I realized that there's something
wrong with:
len = readlink(filename, linkto, sizeof(link) - 1);
sizeof(link) returns the size of link(2), not the linkto char array :P
-- >8 --
readlink is failing because sizeof(link) returns the size of 'link'
which is a function, not the intended char buffer.
Fix the typo.
Signed-off-by: Luca Tettamanti <[email protected]>
---
usb.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/usb.c b/usb.c
index f3a1bef..44d3252 100644
--- a/usb.c
+++ b/usb.c
@@ -52,7 +52,7 @@ void activate_usb_autosuspend(void)
/* skip usb input devices */
sprintf(filename, "/sys/bus/usb/devices/%s/driver",
dirent->d_name);
memset(linkto, 0, sizeof(linkto));
- len = readlink(filename, linkto, sizeof(link) - 1);
+ len = readlink(filename, linkto, sizeof(linkto) - 1);
if (strstr(linkto, "usbhid"))
continue;
Luca
_______________________________________________
Power mailing list
[email protected]
http://www.bughost.org/mailman/listinfo/power