Re: [systemd-devel] how to get a device name matching .device to use into a dynamic@.unit ?
Kaixo! Li Mon, Jun 17, 2013 at 06:40:54PM +0200, Lennart Poettering scrijha: If firmware loading is a one-time thing you need to execute when the device is plugged in, and is relatively quick to execute there is no need to involve a systemd service and you can simply run this from a udev rule directly. Well, the problem is the loader is a user space program (it seems attemps to integrate a loader in the linux kernel have been rejected) that uses the hci0 (or hci1 or watever) interface to upload the firmware. And I find it more elegant to have systemd call the loader, as then there is a single place where it is called (a single file to edit if the loader program is moved, renamed or its command line options change); plus it has the extra bonus of being able to use systemctl status and journalctl to see if the firmware upload went correctly or not. that being said, if udev is the place to go, it's fine too; but then udev is missing an important feature: it should expose the bdaddr of a bluetooth device in it's normal form (eg: 00:02:72:32:DE:FB ) Should I switch to another mailing-list for further udev ? Thanks -- Ki ça vos våye bén, Pablo Saratxaga http://chanae.walon.org/pablo/ PGP Key available, key ID: 0xD9B85466 pgp_l4aAgvgYn.pgp Description: PGP signature ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] how to get a device name matching .device to use into a dynamic@.unit ?
On Tue, Jun 18, 2013 at 04:54:51PM +0200, Pablo Saratxaga wrote: Kaixo! Li Mon, Jun 17, 2013 at 06:40:54PM +0200, Lennart Poettering scrijha: If firmware loading is a one-time thing you need to execute when the device is plugged in, and is relatively quick to execute there is no need to involve a systemd service and you can simply run this from a udev rule directly. Well, the problem is the loader is a user space program (it seems attemps to integrate a loader in the linux kernel have been rejected) that uses the hci0 (or hci1 or watever) interface to upload the firmware. The kernel now has the firmware loader inside of it, no need to use an external program at all. Unless this is an odd device that needs something else? Any pointers to information about it? thanks, greg k-h ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] how to get a device name matching .device to use into a dynamic@.unit ?
Kaixo! Li Mon, Jun 17, 2013 at 09:58:26AM -0700, Greg KH scrijha: Firmware should be loaded directly from the kernel itself these days, no need for a udev rule, or anything else, it should just work. I would prefer that myself too :) But it seems only Debian ships a kernel with a patch for that loader; and even then some people seem to have trouble and need to manually launch the loader to fix it. https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1065400 thanks, greg k-h -- Ki ça vos våye bén, Pablo Saratxaga http://chanae.walon.org/pablo/ PGP Key available, key ID: 0xD9B85466 pgpohZxXA8bC4.pgp Description: PGP signature ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] how to get a device name matching .device to use into a dynamic@.unit ?
On Thu, 13.06.13 13:20, Pablo Saratxaga (pa...@walon.org) wrote: Hello, I'm learning (and appreciating) the new systemd; and I'm currently trying to make it work to load some firmware, in the most generic way. The hardware needing that firmware is a cheap bluetooth usb dongle; so cheap that without loading the firware it just plain doesn't work. If firmware loading is a one-time thing you need to execute when the device is plugged in, and is relatively quick to execute there is no need to involve a systemd service and you can simply run this from a udev rule directly. Lennart -- Lennart Poettering - Red Hat, Inc. ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] how to get a device name matching .device to use into a dynamic@.unit ?
On Mon, Jun 17, 2013 at 06:40:54PM +0200, Lennart Poettering wrote: On Thu, 13.06.13 13:20, Pablo Saratxaga (pa...@walon.org) wrote: Hello, I'm learning (and appreciating) the new systemd; and I'm currently trying to make it work to load some firmware, in the most generic way. The hardware needing that firmware is a cheap bluetooth usb dongle; so cheap that without loading the firware it just plain doesn't work. If firmware loading is a one-time thing you need to execute when the device is plugged in, and is relatively quick to execute there is no need to involve a systemd service and you can simply run this from a udev rule directly. Firmware should be loaded directly from the kernel itself these days, no need for a udev rule, or anything else, it should just work. thanks, greg k-h ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] how to get a device name matching .device to use into a dynamic@.unit ?
Hello, I'm learning (and appreciating) the new systemd; and I'm currently trying to make it work to load some firmware, in the most generic way. The hardware needing that firmware is a cheap bluetooth usb dongle; so cheap that without loading the firware it just plain doesn't work. So, the idea is to have udev trigger a generic systemd .service unit that will call the user space firmware loader with the right parameters. by default the firmware loader uses the interface name (eg: hci0), but that isn't right for a generic solution; what if it actually is named hci1 ? I can however use the bdaddr adress instead, and it seems udev provides it (without the colons) as ID_SERIAL_SHORT However, in order to have the service properly show when listing services with systemctl status, etc; and have it removed when device in unplugged, I made the service BindTo= the generated .device Problem is the generated .device unit has the interface name hci0 in its name. So my questions are: - how to get the interface name of a given device to use in a generic systemd service unit ? can udev provide that ? if not how to retrieve it ? - is the udev variable ID_SERIAL_SHORT always holding the bdaddr of a bluetooth device ? if not, what is the way to write an udev rule so that a given device can be specifically identified ? And here are the udev rules and systemd service files I wrote so far: -- /etc/udev/rules.d/60-brcm_patchram_plus_usb.rules -- SUBSYSTEM!=usb, GOTO=brcm_patchram_plus_usb_end ACTION!=add, GOTO=brcm_patchram_plus_usb_end ## FIXME: should be lines like this (with TAG+=systemd), but I'm unable to make it work (old systemd at home?) ##SUBSYSTEM==usb, ENV{DEVTYPE}==usb_device, ENV{ID_VENDOR_ID}==0a5c, ENV{ID_MODEL_ID}==21e8, GROUP=usb, TAG+=systemd, ENV{SYSTEMD_WANTS}=brcm_patchram_plus_usb@$env{ID_VENDOR_ID}_$env{ID_MODEL_ID}.service ## ACTION==add, SUBSYSTEM==usb, ATTRS{idVendor}==0a5c, ATTRS{idProduct}==21e[1358b-d], GROUP=usb, RUN+=/usr/bin/systemctl start brcm_patchram_plus_usb@$env{ID_VENDOR_ID}_$env{ID_MODEL_ID}.service # end LABEL=brcm_patchram_plus_usb_end -- /etc/systemd/system/brcm_patchram_plus_usb@.service-- [Unit] Description=uploading firmware to Broadcom USB bluetooth device # fixme: how to get the bluez device name? it could be hci1, hci2,... Requires=sys-subsystem-bluetooth-devices-hci0.device After=sys-subsystem-bluetooth-devices-hci0.device BindTo=sys-subsystem-bluetooth-devices-hci0.device [Service] Type=simple RemainAfterExit=yes # fixme: how to get the bluez device name? it could be hci1, hci2,... ExecStart=/usr/bin/brcm_patchram_plus_usb --patchram /lib/firmware/fw-%i.hcd hci0 [Install] Alias=fw-upload-broadcom-bluetooth.service [Service] TimeoutSec=300 (another question: is [Install] section needed at all? the service can be run only when device is plugged, and has to be rerun again with each plug; so doing systemctl {enable|disable} is pointless) The automatically generated .device units are: sys-devices-pci:00-:00:1a.0-usb1-1\x2d1-1\x2d1:1.0-bluetooth-hci0.device loaded active plugged /sys/devices/pci:00/:00:1a.0/usb1/1-1/1-1:1.0/bluetooth/hci0 sys-subsystem-bluetooth-devices-hci0.device loaded active plugged /sys/subsystem/bluetooth/devices/hci0 Thanks -- Ki ça vos våye bén, Pablo Saratxaga http://chanae.walon.org/pablo/ PGP Key available, key ID: 0xD9B85466 pgpIyr01dz71C.pgp Description: PGP signature ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel