How to create a virtual device in linux?

2019-04-09 16:15发布

My question is pretty much the same as - How to create a virtual file? except I want to do it in Linux instead. I imagine what I need to do is create a virtual device and point the application logging to that device. I'd like to write the device in python or ruby or something else interpreted, if possible.

3条回答
相关推荐>>
2楼-- · 2019-04-09 16:34

Use mknod. You can create a socket file which your apps can write too. And your logging app would connect to the socket to read from it.

查看更多
ゆ 、 Hurt°
3楼-- · 2019-04-09 16:36
趁早两清
4楼-- · 2019-04-09 16:45

Mocking usb devices using umockdev

Umockdev is a linux based application which record the behaviour as well as properties of hardware and run the software independent of actual hardware it is running on. Hardware devices can be simulated in virtual environments without disturbing the whole system.It currently supports sysfs, uevents, basic support for /dev devices, and recording/mocking usbdevfs ioctls (for PtP/MTP devices).

umockdev home page

source code and examples

查看更多
登录 后发表回答