On Do, 09.01.20 20:17, Michael K ([email protected]) 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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to