Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/carvilsi/systemd-usb-monitor-example
Simple example about systemd (sd-event & sd-device) to monitor USB devices on connection
https://github.com/carvilsi/systemd-usb-monitor-example
sd-device sd-event systemd unix
Last synced: 27 days ago
JSON representation
Simple example about systemd (sd-event & sd-device) to monitor USB devices on connection
- Host: GitHub
- URL: https://github.com/carvilsi/systemd-usb-monitor-example
- Owner: carvilsi
- License: unlicense
- Created: 2023-09-08T10:37:19.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-06-08T13:59:58.000Z (7 months ago)
- Last Synced: 2024-06-09T15:05:47.261Z (7 months ago)
- Topics: sd-device, sd-event, systemd, unix
- Language: C
- Homepage:
- Size: 103 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# systemd USB monitor example
Simple example about systemd (sd-event & sd-device) to monitor USB devices on connection
## Compile and Run
Compile with **gcc**:
```
gcc usb_sd_device_monitor.c -o usbthingy `pkg-config --libs --cflags libsystemd`
```
And run it:`./usbthingy`
**Note:** It's quite possible that on **Ubuntu** you'll need to install the `libsystem-dev` package. At least was my case for **Ubuntu 23.04** (lunar)
`sudo apt install libsystemd-dev`
Seems that on **Arch Linux** is already installed.
### Example of output
This is the output that I get when I connect my Zowie mouse:
```bash
syspath: /sys/devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1.3
devtype: usb_device
subsystem: usb
first_sysattr: idProduct
first_tag: seat
id_vendor: 1af3
id_product: 0001
product: ZOWIE Gaming mouse
```---
I will appreciate any comment, suggestions or improvement from you; Also if you like it please leave a :star: ;)