I sent this patch (with the change in both activate_usb_autosuspend,
suggest_usb_autosuspend and the since removed instance in urbnum.c), to
the mailing list on 2010-05-26 (Subject: Nits).

I suppose my karma is way to low to push it into the code since Auke
said "for now I don't care about this patch."

Well, it is good that it finally got in.

By the way, nothing ever checks the len variable so that assignment is
unnecessary.

/MF

On Fri, 2010-08-06 at 17:28 +0200, Luca Tettamanti wrote:
> (resending, it seems that my previous message got lost in the moderation
> queue...)
> 
> 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


_______________________________________________
Power mailing list
[email protected]
http://www.bughost.org/mailman/listinfo/power

Reply via email to