Correction: recent kernels > 2.6 do not have ..../power/level --> use
.../power/control

Or something like:
echo 1.4 /sys/bus/usb/drivers/usb/unbind

-T

On Mon, Jan 22, 2024, 15:42 Tomas Kuchta <tomas.kuchta.li...@gmail.com>
wrote:

> While not answering your question - this may solve your problem...
>
> You can cut power to usb device by something like this:
>
> echo suspend > /sys/bus/usb/devices/usb1/power/level
>
> That way, you could just make sure that nothing draws power regardless of
> plugged in or not. It could save you from unplugging stuff manually based
> on some message.
>
> Hope it helps,
> Tomas
>
> On Mon, Jan 22, 2024, 15:12 Vince Winter <thine.technoc...@gmail.com>
> wrote:
>
>> We are running power testing and we need to make sure their isn't USB
>> device plugged in it adds to the total system power by having the USB port
>> activate.
>>
>> I am trying to do a automated is USB plugged.
>>
>> We are using multiple generations of systems that are regularly
>> reinstalled.
>>
>>
>> On Mon, Jan 22, 2024, 9:42 AM Russell Senior <russ...@personaltelco.net>
>> wrote:
>>
>> > I don't quite understand. You are looking for a specific device? How do
>> you
>> > identify the device?
>> >
>> > On Mon, Jan 22, 2024 at 9:35 AM Vince Winter <
>> thine.technoc...@gmail.com>
>> > wrote:
>> >
>> > > I need if USB device is plugged to not to continue the rest of the
>> script
>> > > across multiple devices. I can't change every device and I am trying
>> to
>> > > eliminate humans looking at which devices are plugged in.
>> > >
>> > > I do conceded that many laptop cameras are USB and Bluetooth generally
>> > runs
>> > > on the USB bus.
>> > >
>> > > I have yet to find a good answer to this myself.
>> > >
>> > > On Fri, Jan 19, 2024, 3:54 PM Russell Senior <
>> russ...@personaltelco.net>
>> > > wrote:
>> > >
>> > > > Two things I will mention: lsusb and udev rules.
>> > > >
>> > > > I have a set of udev rules that match ttyusb devices by path (they
>> > don't
>> > > > implement serial numbers, which would be better) and give them a
>> > > > consistently named symlink. I use /dev/ttyRn, where n is a whole
>> > number.
>> > > > That means no matter what order they are enumerated in, I can find
>> the
>> > > > device.
>> > > >
>> > > > I don't know if that helps with your problem or not, but I have
>> found
>> > > them
>> > > > to be useful in adjacent problems.
>> > > >
>> > > > --
>> > > > Russell
>> > > >
>> > > > On Fri, Jan 19, 2024, 15:17 Vince Winter <
>> thine.technoc...@gmail.com>
>> > > > wrote:
>> > > >
>> > > > > Hello,
>> > > > >
>> > > > > I am trying to write a bash script to detect if USB device is
>> plugged
>> > > > into
>> > > > > a device and post a message with a device name that is plugged to
>> > > stdout.
>> > > > >
>> > > > > Complications are USB webcams, USB controllers, and this is going
>> to
>> > be
>> > > > > used on large number of systems, so I can't customize to each
>> system.
>> > > > >
>> > > >
>> > >
>> >
>>
>

Reply via email to