udev

udev rules

让人想犯罪 __ 提交于 2020-01-20 07:24:35
usblcom.rules 文件内容 SUBSYSTEMS=="usb",KERNELS=="1-1.2", ATTRS{idProduct}=="6001", ATTRS{idVendor}=="0403", MODE:="0777", SYMLINK+="usbl_china" $sudo cp usblcom.rules /etc/udev/rules.d $lsusb pi@raspberrypi:~ $ ls -l /sys/class/tty/ttyU* lrwxrwxrwx 1 root root 0 Aug 18 19:16 /sys/class/tty/ttyUSB0 -> ../../devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2/1-1.2:1.0/ttyUSB0/tty/ttyUSB0 lrwxrwxrwx 1 root root 0 Aug 18 19:16 /sys/class/tty/ttyUSB1 -> ../../devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4/1-1.4:1.0/ttyUSB1/tty/ttyUSB1 $ udevadm info -q path -a /dev/ttyUSB1 来源: CSDN 作者: powerfit 链接:

Bringing up interface eth0: Device eth0 does not seem to be presen

杀马特。学长 韩版系。学妹 提交于 2020-01-18 18:10:37
在公司的电脑虚拟机上安装了centos 6.5 ,然后我把他克隆下来用在家里电脑的虚拟机上,打开后查看ip,发现只有回环地址lo,没有eth0, 于是重启网络 输入 service network restart 发现 报错Bringing up interface eth0: Device eth0 does not seem to be present,delaying initialization. [FAILED] 问题原因   克隆的Linux系统在新的机器上运行,新服务器网卡物理地址已经改变。而/etc/udev/rules.d/70-persistent-net.rules这个文件确定了网卡和MAC地址的信息之间的绑定,克隆后的网卡的MAC已经发生了变化,所以导致系统认为网络设备不存在,网络不能正常启动。另外一个就是/etc/sysconfig/network-scripts/ifcfg-eth0里面MAC地址也是以前的旧信息。 关于/etc/udev/rules.d/70-persistent-net.rules这个文件,系统在启动时会自动监测变化,然后由/lib/udev/write_net_rules写入到/etc/udev/rules.d/70-persistent-net.rules中一个新的配置节,网卡的的序号依次递增(如原来为eth0

How can I detect a USB port being used for charging in Linux?

假装没事ソ 提交于 2020-01-15 06:54:11
问题 I'm using a USB port on the Raspberry Pi 3 Model B to charge an accessory via a USB magnetic charging cable. I want to detect when the cable is plugged in and removed from the Pi . I've been plugging in and removing this cable and looking for any traces of this being detected on Linux. So far, I've tried: monitoring udev events by udevadm monitor . tailing the system logs in /var/log etc. running an inotify watch on the /dev directory for new devices looking around in /sys/bus/usb/devices for

Why does linking against both sdl2 and udev cause a segmentation fault?

别来无恙 提交于 2020-01-04 01:53:11
问题 I have the following really dumb C program: #include <SDL2/SDL.h> int main () { SDL_Init(SDL_INIT_VIDEO); } If I compile it and link against sdl2 , all is well: [nix-shell:~/work/on-the-limit]$ gcc oddity.c -lSDL2 -o oddity [nix-shell:~/work/on-the-limit]$ ./oddity However, if I also link against udev ... [nix-shell:~/work/on-the-limit]$ gcc oddity.c -lSDL2 -ludev -o oddity [nix-shell:~/work/on-the-limit]$ ./oddity Segmentation fault ... a segmentation fault happens. gdb has the following to

Linux VMware 克隆后无法启动eth0网卡

♀尐吖头ヾ 提交于 2020-01-02 04:02:37
引:     VMware 下LINUX出现:Device eth0 does not seem to be present, delaying initialization.解决办法 VMWare 克隆 复制 eth0 be present 找不到 解决方案 vmware clone 网卡 VMware 下LINUX下使用ifconfig查看时无eth0网卡相应信息! 当使用克隆后的虚拟机时发现原来在基本系统中的网卡eth0到了新系统却没有了,使用 ifconfig -a会发现只有eth1。因为基本系统的网络相关配置都是基于eth0的,eth1没有网络相关的配置,此时要正常该虚拟机中的网络,只有添加eth1的 网络配置,这样每次都要修改网卡配置在做多Linux系统测试的时候很不方便。更进一步,如果基于此克隆虚拟机继续克隆或复制新的虚拟机,网卡的标识每一 次都会自动加1(第二次克隆会变eth2),dmesg却显示内核只识别到网卡eth0。 原因分析: 很多Linux distribution使用 udev动态管理设备文件 ,并根据设备的信息对其进行持久化命名。例如在Debian etch中,udev会在系统引导的过程中识别网卡,将mac地址和网卡名称对应起来记录在udev的规则脚本中。而VMware会自动生成虚拟机的 mac地址。这样

使用ifconfig看到的网卡名为eth1

天大地大妈咪最大 提交于 2020-01-02 04:00:07
当你克隆或者重装虚拟机软件时,由于你使用的是以前系统虚拟硬盘的信息,而该系统中已经有eth0的信息,对于这个新的网卡,udev会自动将其命名为eth1(累加的原则),所以在你的系统启动后,你使用ifconfig看到的网卡名为eth1。 解决办法: 1.编辑 vim /etc/udev/rules.d/70-persistent-net.rules ,将eth0那行删去,下面的eth1改为eth0 2.打开 vim /etc/sysconfig/network-scripts/ifcfg-eth0,该文件中的mac地址为原来eth0网卡的物理地址,将MAC的地址信息修改为70-persistent-net.rules中的eth1的MAC地址,再次重启网络,就完全恢复到以前eth0网卡的状态了。 启动网络命令service network restart 来源: https://www.cnblogs.com/wangxiaochao/p/9252605.html

systemd/udev dependency failure when auto mounting separate partition during startup

删除回忆录丶 提交于 2020-01-01 09:05:11
问题 EDIT: This occurs when I am trying to use a separate partition with ANY mount point, not just /var . I am using Buildroot to build an embedded linux system. I am trying to use a separate partition for /var, but this occurs for ANY mount point. My init system is systemd, udev for device management. I've edited my fstab to: # <file system> <mount pt> <type> <options> <dump> <pass> /dev/root / ext2 rw,noauto 0 1 /dev/mmcblk0p4 /var ext2 defaults 0 2 proc /proc proc defaults 0 0 devpts /dev/pts

Scripts launched from udev do not have DISPLAY access anymore?

荒凉一梦 提交于 2019-12-29 05:19:26
问题 I have a script that runs from udev when I plug in my external drive. It always worked. But after upgrading from Linux 3.8/Xorg 1.12/Mint 14 ( Ubuntu 12.10 compatible) to Linux 3.11/Xorg 1.14/Mint 16 ( Ubuntu 13.10 compatible), it doesn't work anymore. The script still runs, but none of the commands that require the display work. I figured that out by quitting the udev daemon and manually run udevd --debug for verbose output (more below). This script used to work in Mint 14/12.10 : export

get scsi_device from scsi_generic

本秂侑毒 提交于 2019-12-25 00:35:59
问题 I'm enumerating scsi_generic devices with udev to retrieve the /dev/sg* filename so I can send an Inquiry to each device. Can I also get the /dev/sd* filename (the scsi_device) while I'm right there? If not, how do I get the scsi_device given a scsi_generic path? This is my udev code: IntPtr udev = IntPtr.Zero; IntPtr enumerate = IntPtr.Zero; try { udev = Libudev.udev_new(); if (udev == IntPtr.Zero) throw new UdevException("Failed to create udev"); enumerate = Libudev.udev_enumerate_new(udev)

Why is Python pyusb usb.core access denied due to permissions and why won't the rules.d fix it?

那年仲夏 提交于 2019-12-24 21:29:09
问题 I have a USB device which I'm tring to talk to using pyusb 1.0.2 on linux (Linux tpad 4.15.0-38-generic #41~16.04.1-Ubuntu SMP Wed Oct 10 20:16:04 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux). Running python 3.5 I get the following error (full trace at bottom of this post): usb.core.USBError: [Errno 13] Access denied (insufficient permissions) Mounting the usb and using lsusb and then inspecting it: udevadm info -a -p $(udevadm info -q path -n /dev/bus/usb/006/011) shows looking at device '