Re: Modified usb-devices.sh script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jul 20, 2009 at 2:07 PM, Frans Pop<elendil@xxxxxxxxx> wrote:
> I've given your script a try, but the result was rather bad. It ate all my
> memory and half hung the system. I was also running a kernel compile at
> the time which may have contributed, but that still does not explain.
>
> Eventually I was able to break out of it, but only with some difficulty:
>
Yikes, I had not seen that. I would guess that your kernel's sysfs is
different than mine (running 2.6.24 under Ubuntu). It must be
following some circular linked list somewhere.
>
>> I was not trying to make it faster, but the awk script is about 4
>> times faster than the bash script:
>> "time usb-devices >/dev/null; time usbd.awk >/dev/null"
>
> Almost any language is bound to be faster than shell script, but I would
> personally pick perl rather than awk as the more logical replacement.
>
Yes, speed is not the point. The reason I like awk better than perl
(other than a personal preference for syntax) is that gawk is a single
static executable. Makes for a very simple installation.

> Question is if speed is that much of an issue as the script is not really
> intended to be used in any hot paths. The requirement of bash already
> makes it unsuitable for use in initrds (and so would perl, and possibly
> gawk), although I suspect busybox' shell would run the script correctly
> (provided the shebang is changed to '#! /bin/sh').
>
I agree. With some gawkism removal, busybox's awk could probably also
run a version of the gawk script. I guess most of the use I have made
of cat /proc/bus/usb/devices is to look at my usb tree, not to run in
a script. In that case, as much info as possible is useful for me. Not
having to mount /proc/.../devices is nice too.

Regards, Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux