udev

libusb-1.0 hotplug events stop working in parent after fork(), when child calls libusb_exit()

☆樱花仙子☆ 提交于 2019-12-02 18:09:51
问题 I've been developing an application that monitors the USB device tree using libusb_hotplug_register_callback() . When a device that matches some criteria is attached, it will fork() and exec() an application to handle this device. The application has been working fine for some time now, but I've come back to try and 'tidy it up'... libusb will open a number of file descriptors (see below) which it monitors for events, etc... The problem is that after I call fork() and before I call exec() , I

Change ttyUSB permissions using udev

不打扰是莪最后的温柔 提交于 2019-12-02 12:28:11
问题 My program needs to access ttyUSB without root permission. I tried changing it with chmod 777 /dev/ttyUSB0 as you know, when I reboot this permission changed to default. How can I configure my udev rules.d for this? 回答1: Look for ttyUSB* in the rules.d directory and update it to look lke below: KERNEL=="ttyUSB*", MODE="0777" Leave any other entries you find on the line unchanged, add the mode attribute if it does not exist. 来源: https://stackoverflow.com/questions/14291431/change-ttyusb

libusb-1.0 hotplug events stop working in parent after fork(), when child calls libusb_exit()

和自甴很熟 提交于 2019-12-02 11:11:54
I've been developing an application that monitors the USB device tree using libusb_hotplug_register_callback() . When a device that matches some criteria is attached, it will fork() and exec() an application to handle this device. The application has been working fine for some time now, but I've come back to try and 'tidy it up'... libusb will open a number of file descriptors (see below) which it monitors for events, etc... The problem is that after I call fork() and before I call exec() , I'd like to shutdown libusb, closing the file descriptors and leaving the children in a clean state.

Ubuntu 16.04 adb devices : no permissions 解决方法

≯℡__Kan透↙ 提交于 2019-12-02 10:13:49
一、安装adb和fastboot $sudo apt-get update $sudo apt-get install android-tools-adb android-tools-fastboot 二、出现问题 输入 $adb devices 后发现 因为ubuntu系统都是默认以非root身份在运行的,要使用usb调试,需要sudo支持。 $lsusb 查看usb使用情况 可以看到高通平台的设备相关id是05c6:9091 编辑rules $sudo gedit /etc/udev/rules.d/51-android.rules 添加如下内容 SUBSYSTEM==”usb”,ATTRS{idVendor}==”05c6”,ATTRS{idProduce}==”9091”,MODE=”0666” 然后保存退出,再设置一下权限 $sudo chmod a+rx /etc/udev/rules.d/51-android.rules 运行命令,重启udev: $sudo service udev restart 或 $sudo /etc/init.d/udev restart 拔掉usb重新连上再执行: $adb kill-server $adb devices 一般以上步骤就可以设置OK,能正常运行adb了,但是我设置了上面步骤后仍然显示 可以编辑另外一个rules $sudo

Finding only disk drives using pyudev

微笑、不失礼 提交于 2019-12-02 01:32:04
问题 I'm looking to enumerate all hard disks on a computer using udev and specifically pyudev to enumerate everything: import pyudev context = pyudev.Context() for device in context.list_devices(subsystem='block', DEVTYPE='disk'): print "{}, ({})".format(device.device_node, device.device_type) This prints out the following: /dev/sdb (disk) /dev/sdc (disk) /dev/sda (disk) /dev/sr0 (disk) /dev/loop0 (disk) /dev/loop1 (disk) /dev/loop2 (disk) /dev/loop3 (disk) /dev/loop4 (disk) /dev/loop5 (disk) /dev

ftdi d2xx conflict with ftdi_sio on linux - How to remove ftdi_sio automatically

╄→尐↘猪︶ㄣ 提交于 2019-12-01 23:05:07
I have a rf-reader with ftdio usb to serial chip. I was able to write a program to control it using ftdi d2xx library. So far so good. The issue is that when the reader is reconnected to the PC I have to remove ftdi_sio and usbserial mods using this command: sudo rmmod ftdi_sio sudo rmmod usbserial I can't use ftdi d2xx library to connect to the reader if I don't run the code. I want to be able to add a udev rule so whenever the reader is connected kernel unload the ftdi_sio and usbserial (or not load them in first place) I've added a new udev rul to /etc/udev/rules.d with name 99-ftdi-sio

Getting live info from /dev/input

雨燕双飞 提交于 2019-12-01 16:22:55
I am unsure if this is the correct place for this question. I am attempting to obtain the axis position values from a joystick /dev/input/js0 on my system. If I run jstest /dev/input/js0 it will give me live feedback on all buttons and axis positions. I am trying to feed this information into my C program to control servos. Is there a function for doing this? I have not worked much with input devices in programming so this is all new to me. This page: http://scaryreasoner.wordpress.com/2008/02/22/programming-joysticks-with-linux/ has a nice writeup on how to read the info from /dev/input/js0

Getting live info from /dev/input

穿精又带淫゛_ 提交于 2019-12-01 15:25:28
问题 This question was migrated from Unix & Linux Stack Exchange because it can be answered on Stack Overflow. Migrated 6 years ago . I am unsure if this is the correct place for this question. I am attempting to obtain the axis position values from a joystick /dev/input/js0 on my system. If I run jstest /dev/input/js0 it will give me live feedback on all buttons and axis positions. I am trying to feed this information into my C program to control servos. Is there a function for doing this? I have

How to create a callback for “monitor plugged” on an intel graphics?

送分小仙女□ 提交于 2019-11-30 10:26:44
问题 I've got an eeepc with an intel graphics. I'd like to hook a script to the event of a monitor plugged via VGA. How to do that? 回答1: As a crude solution, you may be able to poll on sysfs. On my laptop I have: $ cat /sys/class/drm/card0-LVDS-1/status connected $ cat /sys/class/drm/card0-VGA-1/status disconnected I'm guessing this requires kernel DRM and possibly KMS. To see if you can trigger something automatically, you could run udevadm monitor --property , and watch while you are (dis-

How to create a callback for “monitor plugged” on an intel graphics?

梦想与她 提交于 2019-11-29 20:11:43
I've got an eeepc with an intel graphics. I'd like to hook a script to the event of a monitor plugged via VGA. How to do that? Andy As a crude solution, you may be able to poll on sysfs. On my laptop I have: $ cat /sys/class/drm/card0-LVDS-1/status connected $ cat /sys/class/drm/card0-VGA-1/status disconnected I'm guessing this requires kernel DRM and possibly KMS. To see if you can trigger something automatically, you could run udevadm monitor --property , and watch while you are (dis-)connecting the monitor to see if events are reported. With my radeon, I get an event the first time I