Re: [systemd-devel] udev event on usb unpluged
sorry for the delay. Attached are the logs. The log show the hole process meaning: Boot Plug of the usb cable: the device is shown as a mass-storage on the other device. Other device umount. I unplug the cable. Shutdown of the device. 'jc.log' is the log from my script. You will see 2 add event, but no remove event. 'udev.log' if the log from udevadm monitor /var/log/udev.log 21 since boot time (I launch it from an init.d script at startup). 1) Why I see event in my jc.log but not in udev.log ?? 2) Why is there no usb event in udev.log (nor add/change or remove ...) ? For completeness, I attach also my .rule and .sh scripts. Thanks for your help. Christophe - Mail original - De: Robert Milasan rmila...@suse.com À: christophe jalady christophe.jal...@free.fr Cc: systemd-devel@lists.freedesktop.org Envoyé: Mercredi 26 Août 2015 14:35:24 Objet: Re: [systemd-devel] udev event on usb unpluged On Wed, 26 Aug 2015 15:32:13 +0200 (CEST) christophe.jal...@free.fr wrote: They are not referring to your device, but the machine on which you are running the rule. In a terminal/console you run: udevadm monitor The do the removal itself and see what 'udevadm monitor' says. this is the problem: the machine which are running the rule is a specific robotic device with one usb port and no screen (and no network device). Either I connect through ssh using the usb cable (eth over usb) or I use the usb cable to test my plug/unplug process. I cannot have a console _and_ test the unplugging at the same time. Then login into that machine and run screen, in which you run: 'udevadm monitor -u -p /tmp/udev.log 21' Do the necessary removal of the usb cable or whatever, then attach the usb cable again, login again and check the log. Christophe -- Robert Milasan L3 Support Engineer SUSE Linux (http://www.suse.com) email: rmila...@suse.com GPG fingerprint: B6FE F4A8 0FA3 3040 3402 6FE7 2F64 167C 1909 6D1A usb-changed.sh Description: application/shellscript 95-usb.rules Description: Binary data monitor will print the received events for: UDEV - the event which udev sends out after rule processing KERNEL - the kernel uevent KERNEL[76.710918] change /devices/platform/leds_pwm/leds/ev3-left1:green:ev3dev (leds) KERNEL[76.753187] change /devices/platform/leds_pwm/leds/ev3-right1:green:ev3dev (leds) KERNEL[76.783563] change /devices/platform/leds_pwm/leds/ev3-left0:red:ev3dev (leds) KERNEL[76.814720] change /devices/platform/leds_pwm/leds/ev3-left0:red:ev3dev (leds) KERNEL[76.859972] change /devices/platform/leds_pwm/leds/ev3-right0:red:ev3dev (leds) KERNEL[76.904334] change /devices/platform/leds_pwm/leds/ev3-right0:red:ev3dev (leds) UDEV [78.253965] change /devices/platform/leds_pwm/leds/ev3-left1:green:ev3dev (leds) UDEV [78.309536] change /devices/platform/leds_pwm/leds/ev3-right1:green:ev3dev (leds) UDEV [78.368676] change /devices/platform/leds_pwm/leds/ev3-left0:red:ev3dev (leds) UDEV [78.447464] change /devices/platform/leds_pwm/leds/ev3-right0:red:ev3dev (leds) UDEV [79.350682] change /devices/platform/leds_pwm/leds/ev3-left0:red:ev3dev (leds) UDEV [79.408343] change /devices/platform/leds_pwm/leds/ev3-right0:red:ev3dev (leds) KERNEL[291.356497] change /devices/platform/leds_pwm/leds/ev3-left1:green:ev3dev (leds) KERNEL[291.382591] change /devices/platform/leds_pwm/leds/ev3-left1:green:ev3dev (leds) KERNEL[291.406296] change /devices/platform/leds_pwm/leds/ev3-right1:green:ev3dev (leds) KERNEL[291.441321] change /devices/platform/leds_pwm/leds/ev3-right1:green:ev3dev (leds) KERNEL[291.475845] change /devices/platform/leds_pwm/leds/ev3-left0:red:ev3dev (leds) KERNEL[291.708675] change /devices/platform/leds_pwm/leds/ev3-right0:red:ev3dev (leds) UDEV [293.290931] change /devices/platform/leds_pwm/leds/ev3-left1:green:ev3dev (leds) UDEV [293.442428] change /devices/platform/leds_pwm/leds/ev3-right1:green:ev3dev (leds) UDEV [293.661357] change /devices/platform/leds_pwm/leds/ev3-left0:red:ev3dev (leds) UDEV [293.739961] change /devices/platform/leds_pwm/leds/ev3-right0:red:ev3dev (leds) UDEV [295.962372] change /devices/platform/leds_pwm/leds/ev3-left1:green:ev3dev (leds) UDEV [296.208847] change /devices/platform/leds_pwm/leds/ev3-right1:green:ev3dev (leds) add /devices/platform/ohci.0/usb1 add /devices/platform/ohci.0/usb1/1-0:1.0 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] udev event on usb unpluged
Are you sure that the add events in jc.log actually appears before you plugin anything? I think usb1 is the host controller/bus and usb1/1-0:1.0 is the internal hub. If it's that case of course you won't see any remove event of them by unpluging your device because the add events doesn't belong to the device as well. In that case, perhaps for some reason your device isn't under the usb subsystem, so the rule is a mismatch for it. As for the `udevadm monitor` log, I don't know how/when exactly your init.d script is ran, but actually you don't have to do it that way. You can just boot up, start capturing udevadm monitor output, then restart systemd-udev-trigger.serivce (or `/usr/bin/udevadm trigger --type=subsystems --action=add ; /usr/bin/udevadm trigger --type=devices --action=add` if you aren't running systemd, that's what the service run), then stop capturing, and you'll basically see what happened when it boot. By the way, Milasan asked you to use -u and -p for udevadm monitor. On 29 August 2015 at 23:30, christophe.jal...@free.fr wrote: sorry for the delay. Attached are the logs. The log show the hole process meaning: Boot Plug of the usb cable: the device is shown as a mass-storage on the other device. Other device umount. I unplug the cable. Shutdown of the device. 'jc.log' is the log from my script. You will see 2 add event, but no remove event. 'udev.log' if the log from udevadm monitor /var/log/udev.log 21 since boot time (I launch it from an init.d script at startup). 1) Why I see event in my jc.log but not in udev.log ?? 2) Why is there no usb event in udev.log (nor add/change or remove ...) ? For completeness, I attach also my .rule and .sh scripts. Thanks for your help. Christophe - Mail original - De: Robert Milasan rmila...@suse.com À: christophe jalady christophe.jal...@free.fr Cc: systemd-devel@lists.freedesktop.org Envoyé: Mercredi 26 Août 2015 14:35:24 Objet: Re: [systemd-devel] udev event on usb unpluged On Wed, 26 Aug 2015 15:32:13 +0200 (CEST) christophe.jal...@free.fr wrote: They are not referring to your device, but the machine on which you are running the rule. In a terminal/console you run: udevadm monitor The do the removal itself and see what 'udevadm monitor' says. this is the problem: the machine which are running the rule is a specific robotic device with one usb port and no screen (and no network device). Either I connect through ssh using the usb cable (eth over usb) or I use the usb cable to test my plug/unplug process. I cannot have a console _and_ test the unplugging at the same time. Then login into that machine and run screen, in which you run: 'udevadm monitor -u -p /tmp/udev.log 21' Do the necessary removal of the usb cable or whatever, then attach the usb cable again, login again and check the log. Christophe -- Robert Milasan L3 Support Engineer SUSE Linux (http://www.suse.com) email: rmila...@suse.com GPG fingerprint: B6FE F4A8 0FA3 3040 3402 6FE7 2F64 167C 1909 6D1A ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] udev event on usb unpluged
re you sure that the add events in jc.log actually appears before you plugin anything? I think usb1 is the host controller/bus and usb1/1-0:1.0 is the internal hub. If it's that case of course you won't see any remove event of them by unpluging your device because the add events doesn't belong to the device as well. In that case, perhaps for some reason your device isn't under the usb subsystem, so the rule is a mismatch for it. I'll check that but you are right: it could explain the behavior. But then, back to my first question: Is it possible to get an event from udev (or whatever) alerting that: either the g_mass_storage is unmounted by the other host _or_ that an usb cable is unplugged. I'll check for the rest of your answer. (thanks by the way!) Christophe - Mail original - De: Tom Yan tom.t...@gmail.com À: christophe jalady christophe.jal...@free.fr Cc: Robert Milasan rmila...@suse.com, systemd systemd-devel@lists.freedesktop.org Envoyé: Samedi 29 Août 2015 19:54:20 Objet: Re: [systemd-devel] udev event on usb unpluged Are you sure that the add events in jc.log actually appears before you plugin anything? I think usb1 is the host controller/bus and usb1/1-0:1.0 is the internal hub. If it's that case of course you won't see any remove event of them by unpluging your device because the add events doesn't belong to the device as well. In that case, perhaps for some reason your device isn't under the usb subsystem, so the rule is a mismatch for it. As for the `udevadm monitor` log, I don't know how/when exactly your init.d script is ran, but actually you don't have to do it that way. You can just boot up, start capturing udevadm monitor output, then restart systemd-udev-trigger.serivce (or `/usr/bin/udevadm trigger --type=subsystems --action=add ; /usr/bin/udevadm trigger --type=devices --action=add` if you aren't running systemd, that's what the service run), then stop capturing, and you'll basically see what happened when it boot. By the way, Milasan asked you to use -u and -p for udevadm monitor. On 29 August 2015 at 23:30, christophe.jal...@free.fr wrote: sorry for the delay. Attached are the logs. The log show the hole process meaning: Boot Plug of the usb cable: the device is shown as a mass-storage on the other device. Other device umount. I unplug the cable. Shutdown of the device. 'jc.log' is the log from my script. You will see 2 add event, but no remove event. 'udev.log' if the log from udevadm monitor /var/log/udev.log 21 since boot time (I launch it from an init.d script at startup). 1) Why I see event in my jc.log but not in udev.log ?? 2) Why is there no usb event in udev.log (nor add/change or remove ...) ? For completeness, I attach also my .rule and .sh scripts. Thanks for your help. Christophe - Mail original - De: Robert Milasan rmila...@suse.com À: christophe jalady christophe.jal...@free.fr Cc: systemd-devel@lists.freedesktop.org Envoyé: Mercredi 26 Août 2015 14:35:24 Objet: Re: [systemd-devel] udev event on usb unpluged On Wed, 26 Aug 2015 15:32:13 +0200 (CEST) christophe.jal...@free.fr wrote: They are not referring to your device, but the machine on which you are running the rule. In a terminal/console you run: udevadm monitor The do the removal itself and see what 'udevadm monitor' says. this is the problem: the machine which are running the rule is a specific robotic device with one usb port and no screen (and no network device). Either I connect through ssh using the usb cable (eth over usb) or I use the usb cable to test my plug/unplug process. I cannot have a console _and_ test the unplugging at the same time. Then login into that machine and run screen, in which you run: 'udevadm monitor -u -p /tmp/udev.log 21' Do the necessary removal of the usb cable or whatever, then attach the usb cable again, login again and check the log. Christophe -- Robert Milasan L3 Support Engineer SUSE Linux (http://www.suse.com) email: rmila...@suse.com GPG fingerprint: B6FE F4A8 0FA3 3040 3402 6FE7 2F64 167C 1909 6D1A ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel