* sysfs bind/unbind attributes usage
@ 2014-07-01 9:07 Raghavendra
2014-07-01 10:43 ` Bjørn Mork
0 siblings, 1 reply; 2+ messages in thread
From: Raghavendra @ 2014-07-01 9:07 UTC (permalink / raw)
To: kernelnewbies
Hello,
I would like to know more about manually probing/removing the devices
through sysfs attributes.
After searching for a while I came across two attributes 'bind' and
'unbind' present in all the drivers.
Now how may I correctly use them to probe my devices.
I sense the probing syntax is different for different kinds of drivers
(I2C, SPI, PCI, USB, etc).
I am mainly looking for probing I2C and SPI devices.
Also I found related attributes called 'new_id and remove_id' (for PCI
drivers) and also 'new_device and delete_device' (present in the i2c
adapter devices). Now how are they different from the bind/unbind
attributes, because as far as I know, even they do the same thing.
Could any one guide me through any documentation regarding all these issues
Thanks,
Raghavendra
-------------------------------------------------------------------------------------------------------------------------------
[ C-DAC is on Social-Media too. Kindly follow us at:
Facebook: https://www.facebook.com/CDACINDIA & Twitter: @cdacindia ]
This e-mail is for the sole use of the intended recipient(s) and may
contain confidential and privileged information. If you are not the
intended recipient, please contact the sender by reply e-mail and destroy
all copies and the original message. Any unauthorized review, use,
disclosure, dissemination, forwarding, printing or copying of this email
is strictly prohibited and appropriate legal action will be taken.
-------------------------------------------------------------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 2+ messages in thread
* sysfs bind/unbind attributes usage
2014-07-01 9:07 sysfs bind/unbind attributes usage Raghavendra
@ 2014-07-01 10:43 ` Bjørn Mork
0 siblings, 0 replies; 2+ messages in thread
From: Bjørn Mork @ 2014-07-01 10:43 UTC (permalink / raw)
To: kernelnewbies
Raghavendra <arrao@cdac.in> writes:
> Hello,
>
> I would like to know more about manually probing/removing the devices
> through sysfs attributes.
> After searching for a while I came across two attributes 'bind' and
> 'unbind' present in all the drivers.
>
> Now how may I correctly use them to probe my devices.
> I sense the probing syntax is different for different kinds of drivers
> (I2C, SPI, PCI, USB, etc).
> I am mainly looking for probing I2C and SPI devices.
sysfs attributes are supposed to be documented under
'Documentation/ABI/' but there seems to be a few holes there:
bjorn at nemi:/usr/local/src/git/linux$ git grep bind Documentation/ABI/
Documentation/ABI/testing/configfs-usb-gadget: UDC - bind a gadget to UDC/unbind a gadget;
Documentation/ABI/testing/configfs-usb-gadget: to bind a gadget, empty string "" to unbind.
Documentation/ABI/testing/sysfs-bus-pci:What: /sys/bus/pci/drivers/.../bind
Documentation/ABI/testing/sysfs-bus-pci: the driver to attempt to bind to the device found at
Documentation/ABI/testing/sysfs-bus-pci: bindings. The format for the location is: DDDD:BB:DD.F.
Documentation/ABI/testing/sysfs-bus-pci: # echo 0000:00:19.0 > /sys/bus/pci/drivers/foo/bind
Documentation/ABI/testing/sysfs-bus-pci:What: /sys/bus/pci/drivers/.../unbind
Documentation/ABI/testing/sysfs-bus-pci: driver to attempt to unbind from the device found at
Documentation/ABI/testing/sysfs-bus-pci: bindings. The format for the location is: DDDD:BB:DD.F.
Documentation/ABI/testing/sysfs-bus-pci: # echo 0000:00:19.0 > /sys/bus/pci/drivers/foo/unbind
Documentation/ABI/testing/sysfs-bus-pci: for the device and attempt to bind to it. For example:
Documentation/ABI/testing/sysfs-bus-pci: to driver_override will have an opportunity to bind to the
Documentation/ABI/testing/sysfs-bus-pci: This returns the device to standard matching rules binding.
Documentation/ABI/testing/sysfs-bus-pci: Writing to driver_override does not automatically unbind the
Documentation/ABI/testing/sysfs-bus-pci: will not bind to any driver. This also allows devices to
Documentation/ABI/testing/sysfs-bus-pci: opt-out of driver binding using a driver_override name such as
Documentation/ABI/testing/sysfs-bus-usb: for the device and attempt to bind to it. For example:
I am pretty sure patches to fix this are accepted...
The bind/unbind attributes normally (always?) take a bus specific device
name as input. I.e something like the '0000:00:19.0' shown above for
PCI, or '4-2:1.2' for USB.
> Also I found related attributes called 'new_id and remove_id' (for PCI
> drivers) and also 'new_device and delete_device' (present in the i2c
> adapter devices).
These are better documented:
bjorn at nemi:/usr/local/src/git/linux$ git grep new_id Documentation/ABI/
Documentation/ABI/testing/sysfs-bus-pci:What: /sys/bus/pci/drivers/.../new_id
Documentation/ABI/testing/sysfs-bus-pci: # echo "8086 10f5" > /sys/bus/pci/drivers/foo/new_id
Documentation/ABI/testing/sysfs-bus-pci: that was dynamically added via the new_id sysfs entry.
Documentation/ABI/testing/sysfs-bus-usb:What: /sys/bus/usb/drivers/.../new_id
Documentation/ABI/testing/sysfs-bus-usb: # echo "8086 10f5" > /sys/bus/usb/drivers/foo/new_id
Documentation/ABI/testing/sysfs-bus-usb: # echo "0458 7045 0 0458 704c" > /sys/bus/usb/drivers/foo/new_id
Documentation/ABI/testing/sysfs-bus-usb: # cat /sys/bus/usb/drivers/foo/new_id
Documentation/ABI/testing/sysfs-bus-usb:What: /sys/bus/usb-serial/drivers/.../new_id
Documentation/ABI/testing/sysfs-bus-usb: "/sys/bus/usb/drivers/.../new_id" apply.
Documentation/ABI/testing/sysfs-bus-usb: that was dynamically added via the new_id sysfs entry.
Documentation/ABI/testing/sysfs-bus-usb: "/sys/bus/usb/drivers/.../new_id"
> Now how are they different from the bind/unbind
> attributes, because as far as I know, even they do the same thing.
No, they do different things.
The bind/unbind attributes tries to attach/detach a driver to/from a
device supported by that driver. The new_id/remove_id attributes
adds/removes device IDs to/from the list of devices supported by the
driver.
Adding a new device ID to a driver will usually cause previously unbound
devices with a matching ID to be bound though, which I guess is the part
confusing you.
> Could any one guide me through any documentation regarding all these issues
Looks like you'll have to write some of that documentation ;-)
Bj?rn
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-07-01 10:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-01 9:07 sysfs bind/unbind attributes usage Raghavendra
2014-07-01 10:43 ` Bjørn Mork
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.