Re: USB Key light on/off state depending on mount

2007-09-07 Thread Casey Dahlin

Sorry to have left this dormant for so long.

Running eject in either of the ways suggested still leaves the light on 
my particular key turned on.


Stefan Richter wrote:

Guennadi Liakhovetski wrote:
  
I might imagine how windows turns the LED off on 
unmount. Try "eject /dev/sdX", where sdX is your USB storage, after you 
unmount it. Be careful, especially if you have SATA (or SCSI) discs in 
your system or if you use libata for PATA discs not to eject the wrong 
one...



If there is only one USB disk connected:
# eject /dev/disk/by-path/*usb*:0

Provided you let udev create links for you.  BTW, the /dev/disk/by-id/
symlinks are nice for static mount points in /etc/fstab.

After a disk was mounted, eject also accepts the mountpoint as parameter
and will unmount the disk before it tries to eject it.
  


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: USB Key light on/off state depending on mount

2007-09-07 Thread Casey Dahlin

Sorry to have left this dormant for so long.

Running eject in either of the ways suggested still leaves the light on 
my particular key turned on.


Stefan Richter wrote:

Guennadi Liakhovetski wrote:
  
I might imagine how windows turns the LED off on 
unmount. Try eject /dev/sdX, where sdX is your USB storage, after you 
unmount it. Be careful, especially if you have SATA (or SCSI) discs in 
your system or if you use libata for PATA discs not to eject the wrong 
one...



If there is only one USB disk connected:
# eject /dev/disk/by-path/*usb*:0

Provided you let udev create links for you.  BTW, the /dev/disk/by-id/
symlinks are nice for static mount points in /etc/fstab.

After a disk was mounted, eject also accepts the mountpoint as parameter
and will unmount the disk before it tries to eject it.
  


-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: USB Key light on/off state depending on mount

2007-08-26 Thread Xavier Bestel



On Sat, 25 Aug 2007 21:26:09 +0200 (CEST), Guennadi Liakhovetski
<[EMAIL PROTECTED]> wrote:
> On Fri, 24 Aug 2007, Josh Boyer wrote:
> 
>> On 8/24/07, Casey Dahlin <[EMAIL PROTECTED]> wrote:
>> > Most USB keys nowadays have a small LED somewhere inside of them that
>> > lights up when they are plugged in. On a windows box, the key is lit
> up
>> > whenever it is mounted, and as soon as it is unmounted it turns off,
>> > giving a handy physical indicator that the key is safe to remove. On
>> > linux, the light is simply on whenever the key is plugged in.

Windows powers off the USB device on unmount, whereas linus does not.
I think the problem may lie in HAL.

Xav


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: USB Key light on/off state depending on mount

2007-08-26 Thread Xavier Bestel



On Sat, 25 Aug 2007 21:26:09 +0200 (CEST), Guennadi Liakhovetski
[EMAIL PROTECTED] wrote:
 On Fri, 24 Aug 2007, Josh Boyer wrote:
 
 On 8/24/07, Casey Dahlin [EMAIL PROTECTED] wrote:
  Most USB keys nowadays have a small LED somewhere inside of them that
  lights up when they are plugged in. On a windows box, the key is lit
 up
  whenever it is mounted, and as soon as it is unmounted it turns off,
  giving a handy physical indicator that the key is safe to remove. On
  linux, the light is simply on whenever the key is plugged in.

Windows powers off the USB device on unmount, whereas linus does not.
I think the problem may lie in HAL.

Xav


-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: USB Key light on/off state depending on mount

2007-08-25 Thread Stefan Richter
Guennadi Liakhovetski wrote:
> I might imagine how windows turns the LED off on 
> unmount. Try "eject /dev/sdX", where sdX is your USB storage, after you 
> unmount it. Be careful, especially if you have SATA (or SCSI) discs in 
> your system or if you use libata for PATA discs not to eject the wrong 
> one...

If there is only one USB disk connected:
# eject /dev/disk/by-path/*usb*:0

Provided you let udev create links for you.  BTW, the /dev/disk/by-id/
symlinks are nice for static mount points in /etc/fstab.

After a disk was mounted, eject also accepts the mountpoint as parameter
and will unmount the disk before it tries to eject it.
-- 
Stefan Richter
-=-=-=== =--- ==-=-
http://arcgraph.de/sr/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: USB Key light on/off state depending on mount

2007-08-25 Thread Guennadi Liakhovetski
On Fri, 24 Aug 2007, Josh Boyer wrote:

> On 8/24/07, Casey Dahlin <[EMAIL PROTECTED]> wrote:
> > Most USB keys nowadays have a small LED somewhere inside of them that
> > lights up when they are plugged in. On a windows box, the key is lit up
> > whenever it is mounted, and as soon as it is unmounted it turns off,
> > giving a handy physical indicator that the key is safe to remove. On
> > linux, the light is simply on whenever the key is plugged in.
> >
> > Should linux toggle the light depending on mount state? Is it as trivial
> > as it seems or does this reflect some larger issue?
> 
> I think that depends on the key.  My Corsair keys have the light
> flicker whenever I/O is on-going.

Yeah, it does, I am not a big expert in USB storage, and I haven't seen 
many USB sticks, but I might imagine how windows turns the LED off on 
unmount. Try "eject /dev/sdX", where sdX is your USB storage, after you 
unmount it. Be careful, especially if you have SATA (or SCSI) discs in 
your system or if you use libata for PATA discs not to eject the wrong 
one... For example, if you think you have to eject /dev/sdc, check before 
ejecting it with "mount" if there are any /dev/sdc* partitions mounted.

As for LED going on only when mounting, don't know. Maybe they also issue 
eject after initial enumeration? In which case the LED would go shortly on 
on plug in, then off, then on again on mount. You can try it under Linux 
too, if you issue eject after plugging in but before mount. I think, you 
won't be able to mount it directly after ejecting, you'd have to force 
re-enumeration under Linux.

Thanks
Guennadi
---
Guennadi Liakhovetski
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: USB Key light on/off state depending on mount

2007-08-25 Thread Éric Piel

25/08/07 12:49, James Bruce wrote/a écrit:

Robert Hancock wrote:

Casey Dahlin wrote:
Most USB keys nowadays have a small LED somewhere inside of them that 
lights up when they are plugged in. On a windows box, the key is lit 
up whenever it is mounted, and as soon as it is unmounted it turns 
off, giving a handy physical indicator that the key is safe to 
remove. On linux, the light is simply on whenever the key is plugged in.


Should linux toggle the light depending on mount state? Is it as 
trivial as it seems or does this reflect some larger issue?


I think that Windows turns off power to the port when you do the 
"safely remove hardware" on it, or something like that. Mount/unmount 
doesn't really indicate whether the device is in use in Linux, though, 
since it can still be potentially accessed even when the device isn't 
mounted.


If there is a way to toggle the power state from userspace, then a 
desktop environment or userland tool can emulate the Windows behavior if 
that is desired.  A lot of devices can charge via USB now, and this is 
actually more convenient on Linux than on Windows (in effect Windows 
requires drivers in order to charge something).  However, having direct 
control over this is useful.
Yes, maybe some userspace such as HAL could turn off the usb devices at 
the same time it's unmounted. Actually that would be rather intuitive 
way to tell the user the umount is finished. There doesn't seem to be 
any loss of funcitonality, once it's turned off you can still re-access 
the device, and it's automatically turned on again (at least on my PC).


For the record, here is how one can switch off a usb device (as root):
# cd /sys/bus/usb/devices/usb*/[0-9]-[0-9] (just go to the directory of 
the device)

# echo -n 2 > *:1.0/power/state
# echo -n 2 > power/state

I use this to turn off my optical mouse when watching movies, but it 
works fine as well to turn off usb storage devices.

It can also be turned on with
# echo -n 0 > power/state

See you,
Eric
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: USB Key light on/off state depending on mount

2007-08-25 Thread James Bruce

Robert Hancock wrote:

Casey Dahlin wrote:
Most USB keys nowadays have a small LED somewhere inside of them that 
lights up when they are plugged in. On a windows box, the key is lit 
up whenever it is mounted, and as soon as it is unmounted it turns 
off, giving a handy physical indicator that the key is safe to remove. 
On linux, the light is simply on whenever the key is plugged in.


Should linux toggle the light depending on mount state? Is it as 
trivial as it seems or does this reflect some larger issue?


I think that Windows turns off power to the port when you do the "safely 
remove hardware" on it, or something like that. Mount/unmount doesn't 
really indicate whether the device is in use in Linux, though, since it 
can still be potentially accessed even when the device isn't mounted.


If there is a way to toggle the power state from userspace, then a 
desktop environment or userland tool can emulate the Windows behavior if 
that is desired.  A lot of devices can charge via USB now, and this is 
actually more convenient on Linux than on Windows (in effect Windows 
requires drivers in order to charge something).  However, having direct 
control over this is useful.


According to the following thread, it appears one can get the needed 
functionality through libusb:

http://www.mail-archive.com/[EMAIL PROTECTED]/msg19131.html
http://www.gniibe.org/ac-power-by-usb/ac-power-control.html

 - Jim

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: USB Key light on/off state depending on mount

2007-08-25 Thread James Bruce

Robert Hancock wrote:

Casey Dahlin wrote:
Most USB keys nowadays have a small LED somewhere inside of them that 
lights up when they are plugged in. On a windows box, the key is lit 
up whenever it is mounted, and as soon as it is unmounted it turns 
off, giving a handy physical indicator that the key is safe to remove. 
On linux, the light is simply on whenever the key is plugged in.


Should linux toggle the light depending on mount state? Is it as 
trivial as it seems or does this reflect some larger issue?


I think that Windows turns off power to the port when you do the safely 
remove hardware on it, or something like that. Mount/unmount doesn't 
really indicate whether the device is in use in Linux, though, since it 
can still be potentially accessed even when the device isn't mounted.


If there is a way to toggle the power state from userspace, then a 
desktop environment or userland tool can emulate the Windows behavior if 
that is desired.  A lot of devices can charge via USB now, and this is 
actually more convenient on Linux than on Windows (in effect Windows 
requires drivers in order to charge something).  However, having direct 
control over this is useful.


According to the following thread, it appears one can get the needed 
functionality through libusb:

http://www.mail-archive.com/[EMAIL PROTECTED]/msg19131.html
http://www.gniibe.org/ac-power-by-usb/ac-power-control.html

 - Jim

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: USB Key light on/off state depending on mount

2007-08-25 Thread Éric Piel

25/08/07 12:49, James Bruce wrote/a écrit:

Robert Hancock wrote:

Casey Dahlin wrote:
Most USB keys nowadays have a small LED somewhere inside of them that 
lights up when they are plugged in. On a windows box, the key is lit 
up whenever it is mounted, and as soon as it is unmounted it turns 
off, giving a handy physical indicator that the key is safe to 
remove. On linux, the light is simply on whenever the key is plugged in.


Should linux toggle the light depending on mount state? Is it as 
trivial as it seems or does this reflect some larger issue?


I think that Windows turns off power to the port when you do the 
safely remove hardware on it, or something like that. Mount/unmount 
doesn't really indicate whether the device is in use in Linux, though, 
since it can still be potentially accessed even when the device isn't 
mounted.


If there is a way to toggle the power state from userspace, then a 
desktop environment or userland tool can emulate the Windows behavior if 
that is desired.  A lot of devices can charge via USB now, and this is 
actually more convenient on Linux than on Windows (in effect Windows 
requires drivers in order to charge something).  However, having direct 
control over this is useful.
Yes, maybe some userspace such as HAL could turn off the usb devices at 
the same time it's unmounted. Actually that would be rather intuitive 
way to tell the user the umount is finished. There doesn't seem to be 
any loss of funcitonality, once it's turned off you can still re-access 
the device, and it's automatically turned on again (at least on my PC).


For the record, here is how one can switch off a usb device (as root):
# cd /sys/bus/usb/devices/usb*/[0-9]-[0-9] (just go to the directory of 
the device)

# echo -n 2  *:1.0/power/state
# echo -n 2  power/state

I use this to turn off my optical mouse when watching movies, but it 
works fine as well to turn off usb storage devices.

It can also be turned on with
# echo -n 0  power/state

See you,
Eric
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: USB Key light on/off state depending on mount

2007-08-25 Thread Guennadi Liakhovetski
On Fri, 24 Aug 2007, Josh Boyer wrote:

 On 8/24/07, Casey Dahlin [EMAIL PROTECTED] wrote:
  Most USB keys nowadays have a small LED somewhere inside of them that
  lights up when they are plugged in. On a windows box, the key is lit up
  whenever it is mounted, and as soon as it is unmounted it turns off,
  giving a handy physical indicator that the key is safe to remove. On
  linux, the light is simply on whenever the key is plugged in.
 
  Should linux toggle the light depending on mount state? Is it as trivial
  as it seems or does this reflect some larger issue?
 
 I think that depends on the key.  My Corsair keys have the light
 flicker whenever I/O is on-going.

Yeah, it does, I am not a big expert in USB storage, and I haven't seen 
many USB sticks, but I might imagine how windows turns the LED off on 
unmount. Try eject /dev/sdX, where sdX is your USB storage, after you 
unmount it. Be careful, especially if you have SATA (or SCSI) discs in 
your system or if you use libata for PATA discs not to eject the wrong 
one... For example, if you think you have to eject /dev/sdc, check before 
ejecting it with mount if there are any /dev/sdc* partitions mounted.

As for LED going on only when mounting, don't know. Maybe they also issue 
eject after initial enumeration? In which case the LED would go shortly on 
on plug in, then off, then on again on mount. You can try it under Linux 
too, if you issue eject after plugging in but before mount. I think, you 
won't be able to mount it directly after ejecting, you'd have to force 
re-enumeration under Linux.

Thanks
Guennadi
---
Guennadi Liakhovetski
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: USB Key light on/off state depending on mount

2007-08-25 Thread Stefan Richter
Guennadi Liakhovetski wrote:
 I might imagine how windows turns the LED off on 
 unmount. Try eject /dev/sdX, where sdX is your USB storage, after you 
 unmount it. Be careful, especially if you have SATA (or SCSI) discs in 
 your system or if you use libata for PATA discs not to eject the wrong 
 one...

If there is only one USB disk connected:
# eject /dev/disk/by-path/*usb*:0

Provided you let udev create links for you.  BTW, the /dev/disk/by-id/
symlinks are nice for static mount points in /etc/fstab.

After a disk was mounted, eject also accepts the mountpoint as parameter
and will unmount the disk before it tries to eject it.
-- 
Stefan Richter
-=-=-=== =--- ==-=-
http://arcgraph.de/sr/
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: USB Key light on/off state depending on mount

2007-08-24 Thread Robert Hancock

Casey Dahlin wrote:
Most USB keys nowadays have a small LED somewhere inside of them that 
lights up when they are plugged in. On a windows box, the key is lit up 
whenever it is mounted, and as soon as it is unmounted it turns off, 
giving a handy physical indicator that the key is safe to remove. On 
linux, the light is simply on whenever the key is plugged in.


Should linux toggle the light depending on mount state? Is it as trivial 
as it seems or does this reflect some larger issue?


I think that Windows turns off power to the port when you do the "safely 
remove hardware" on it, or something like that. Mount/unmount doesn't 
really indicate whether the device is in use in Linux, though, since it 
can still be potentially accessed even when the device isn't mounted.


--
Robert Hancock  Saskatoon, SK, Canada
To email, remove "nospam" from [EMAIL PROTECTED]
Home Page: http://www.roberthancock.com/

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: USB Key light on/off state depending on mount

2007-08-24 Thread Josh Boyer
On 8/24/07, Casey Dahlin <[EMAIL PROTECTED]> wrote:
> Most USB keys nowadays have a small LED somewhere inside of them that
> lights up when they are plugged in. On a windows box, the key is lit up
> whenever it is mounted, and as soon as it is unmounted it turns off,
> giving a handy physical indicator that the key is safe to remove. On
> linux, the light is simply on whenever the key is plugged in.
>
> Should linux toggle the light depending on mount state? Is it as trivial
> as it seems or does this reflect some larger issue?

I think that depends on the key.  My Corsair keys have the light
flicker whenever I/O is on-going.

josh
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


USB Key light on/off state depending on mount

2007-08-24 Thread Casey Dahlin
Most USB keys nowadays have a small LED somewhere inside of them that 
lights up when they are plugged in. On a windows box, the key is lit up 
whenever it is mounted, and as soon as it is unmounted it turns off, 
giving a handy physical indicator that the key is safe to remove. On 
linux, the light is simply on whenever the key is plugged in.


Should linux toggle the light depending on mount state? Is it as trivial 
as it seems or does this reflect some larger issue?


-Casey Dahlin
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


USB Key light on/off state depending on mount

2007-08-24 Thread Casey Dahlin
Most USB keys nowadays have a small LED somewhere inside of them that 
lights up when they are plugged in. On a windows box, the key is lit up 
whenever it is mounted, and as soon as it is unmounted it turns off, 
giving a handy physical indicator that the key is safe to remove. On 
linux, the light is simply on whenever the key is plugged in.


Should linux toggle the light depending on mount state? Is it as trivial 
as it seems or does this reflect some larger issue?


-Casey Dahlin
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: USB Key light on/off state depending on mount

2007-08-24 Thread Josh Boyer
On 8/24/07, Casey Dahlin [EMAIL PROTECTED] wrote:
 Most USB keys nowadays have a small LED somewhere inside of them that
 lights up when they are plugged in. On a windows box, the key is lit up
 whenever it is mounted, and as soon as it is unmounted it turns off,
 giving a handy physical indicator that the key is safe to remove. On
 linux, the light is simply on whenever the key is plugged in.

 Should linux toggle the light depending on mount state? Is it as trivial
 as it seems or does this reflect some larger issue?

I think that depends on the key.  My Corsair keys have the light
flicker whenever I/O is on-going.

josh
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: USB Key light on/off state depending on mount

2007-08-24 Thread Robert Hancock

Casey Dahlin wrote:
Most USB keys nowadays have a small LED somewhere inside of them that 
lights up when they are plugged in. On a windows box, the key is lit up 
whenever it is mounted, and as soon as it is unmounted it turns off, 
giving a handy physical indicator that the key is safe to remove. On 
linux, the light is simply on whenever the key is plugged in.


Should linux toggle the light depending on mount state? Is it as trivial 
as it seems or does this reflect some larger issue?


I think that Windows turns off power to the port when you do the safely 
remove hardware on it, or something like that. Mount/unmount doesn't 
really indicate whether the device is in use in Linux, though, since it 
can still be potentially accessed even when the device isn't mounted.


--
Robert Hancock  Saskatoon, SK, Canada
To email, remove nospam from [EMAIL PROTECTED]
Home Page: http://www.roberthancock.com/

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/