LED devices
Kay Sievers
kay.sievers at vrfy.org
Fri Jun 1 09:40:04 PDT 2007
On Fri, 2007-06-01 at 17:29 +0100, Richard Purdie wrote:
> On Fri, 2007-06-01 at 18:12 +0200, Kay Sievers wrote:
> > On Fri, 2007-06-01 at 16:56 +0100, Richard Purdie wrote:
> > > I've often wished we could do this as it would suit triggers well! The
> > > same approach could be used for bio schedulers and other selection type
> > > operations. As you say its not really possible though and would be more
> > > difficult to use in reality.
> >
> > I'm not familiar with the whole infrastructure, so I might be on the
> > wrong track. :)
> >
> > Wouldn't something like the blockdev holders/ slaves/ subdirs work to
> > express such a relationship?
> >
> > $ ls -l /sys/block
> > md0 -> ../devices/virtual/block/md0
> > sda -> ../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda
> > sr0 -> ../devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0
> >
> > $ ls -l /sys/block/md0/slaves
> > sda8 -> ../../../../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8
> > sda9 -> ../../../../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9
> >
> > $ ls -l /sys/block/sda/sda8/holders
> > md0 -> ../../../../../../../../../../devices/virtual/block/md0
> >
> > It shows the relationship in both directions, and is not limited to a
> > single relation per device.
>
> Can userspace trigger a change of this relationship though?
Sure, but there is no standard way of doing it. For the block stuff,
it's done with ioctl's on a control-device-node.
> We need to
> be able to change the trigger an LED is using...
>
> At the moment the trigger attribute functions
> like /sys/block/*/queue/scheduler:
>
> # cat /sys/block/sda/queue/scheduler
> noop anticipatory deadline [cfq]
>
> # echo "noop" > /sys/block/sda/queue/scheduler
>
> # cat /sys/block/sda/queue/scheduler
> [noop] anticipatory deadline cfq
Yes, a sysfs mechanism will probably work fine for the led stuff.
Similar to the bind/unbind interface at the bus-driver level:
$ ls -l /sys/bus/usb/drivers/hub/
1-0:1.0 -> ../../../../devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0
2-0:1.0 -> ../../../../devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0
3-0:1.0 -> ../../../../devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0
bind
module -> ../../../../module/usbcore
new_id
unbind
The bind/unbind files expect the bus-id's of the device, the driver
should bind/unbind.
Kay
More information about the hal
mailing list