[systemd-devel] unbinding using libudev
Michael K
vk2bea at yahoo.com
Thu Jan 9 20:17:59 UTC 2020
I'm trying to use libudev to unbind a usb device from usb-storage driver ..This does not seem to work. Can I even do what I'm trying to do or am I just doing it wrong ?In the shell # echo -n "1-1.1:1.0" > /sys/bus/usb/drivers/usb-storage/unbind works but this doesn't ...
gchar *sTestUFD= "1-1.1:1.0";
struct udev *udev = udev_new(); struct udev_device *device; if( (device = udev_device_new_from_syspath( udev, "/sys/bus/usb/drivers/usb-storage" )) != NULL ) { if( udev_device_set_sysattr_value( device, "unbind", sTestUFD ) < 0 ) { sd_journal_print( LOG_NOTICE, "Cannot unbind %s", sTestUFD ); } udev_device_unref( device ); } else { sd_journal_perror( "Cannot get /sys/bus/usb/drivers/usb-storage" ); } udev_unref( udev );
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20200109/2fe8372b/attachment.htm>
More information about the systemd-devel
mailing list