Re: unbinding using libudev

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Do, 09.01.20 20:17, Michael K (vk2bea@xxxxxxxxx) wrote:

> 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 );

Please send proper ASCII emails, the above is just really borked.

The code looks roughly OK, but maybe strace it to see if it does the
right things.

Lennart

--
Lennart Poettering, Berlin
_______________________________________________
systemd-devel mailing list
systemd-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/systemd-devel




[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux