udev

Get link speed programmatically?

我怕爱的太早我们不能终老 提交于 2019-12-17 15:51:44
问题 I am writing an application that reports attributes of network devices on the local machine. I need the mac address, mtu, link speed and a few others. I'm using udev for this. I've already figured out how to get the mac address and mtu, but not how to get the link speed. I can get it with ethtool from the terminal, but I need a way to get it programmatically. Does anyone know how I can get the link speed attribute with udev or another library? 回答1: You need to use the SIOCETHTOOL ioctl() call

Get link speed programmatically?

我们两清 提交于 2019-12-17 15:51:35
问题 I am writing an application that reports attributes of network devices on the local machine. I need the mac address, mtu, link speed and a few others. I'm using udev for this. I've already figured out how to get the mac address and mtu, but not how to get the link speed. I can get it with ethtool from the terminal, but I need a way to get it programmatically. Does anyone know how I can get the link speed attribute with udev or another library? 回答1: You need to use the SIOCETHTOOL ioctl() call

Adb stops detecting my phone after a while

房东的猫 提交于 2019-12-13 12:53:10
问题 I am developing for android on a linux machine and I have already created a udev rule for android and it works. After a while if I unplug the device and plug it back in again, adb doesn't recognize the device if I run lusb or dmesg to get information about the device. I tried reload the udev rules and it does not work, I even tried to kill the adb process but it still does not work. Can someone help? Anyway, thank you. 回答1: This appears to be a real problem on linux, at some point in time a

Need to find and open a USB serial device on linux

折月煮酒 提交于 2019-12-13 07:37:45
问题 I'm writing a small C application to run on my (Linux) QNAP NAS that will talk to an Arduino (I have no difficulty with any of the USB code for the arduino). (The arduino has a trusted application on it that accepts text commands via USB serial.) My wish was to find it using the USB vendor/product IDs (only half implemented at the moment). What I have so far (see below) works quite nicely in that it does find the device. // runs on NAS #include <stdio.h> #include <usb.h> main () { struct usb

UDEV-How to get value of a child device attributes

試著忘記壹切 提交于 2019-12-13 01:22:03
问题 I am writting an udev rule to set name of two serial ports. I want to use the value of the attribute bInterfaceNumber in the symlink. My rules is: SUBSYSTEMS=="usb", DRIVERS=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6010", SYMLINK+="toto%s{bInterfaceNumber}" The rule matched the device but value of the attribute is never found. Here is the hierarchical view of one device: console@host:udevadm info --name=/dev/ttyUSB0 --attribute-walk looking at parent device '/devices/pci0000:00

Udev rule is not being applied

馋奶兔 提交于 2019-12-12 05:17:05
问题 I am running a Linux chroot environment on an Android device and I am attempting to communicate with an Atmel atmega2560 based (Arduino Mega derived) microcontroller. Doing "ls -ld /dev/ttyACM0" shows the following permissions for the modem: crw------- 1 root root 166, 0 Feb 11 22:28 /dev/ttyACM0 "lsusb" tells me: Bus 003 Devices: ID 03eb:204b Atmel Corp. LUFA USB to Serial Adpater Project "udevadm info --attribute-walk --name=ttyACM0" says: Udevadm info starts with the device specified by

Script not working when evoked by udev rule

血红的双手。 提交于 2019-12-12 03:34:54
问题 I am a Linux Mint user and I am trying to write a rule, that execute a script when I plug in the usb. The #!/bin/sh script , does not succeed to access the USB (even with a normal cd) while if I run the same script from command line, it works perfectly. The rule I created for that purpose is: ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="058f", ATTR{idProduct}=="6387", RUN+=="/home/dario/bin/backup_usb" where the backup_usb for instance looks like: #!/bin/sh sleep 10 cd /media/dario/ echo

Open an lxterminal window via shell script triggered by udev rule

て烟熏妆下的殇ゞ 提交于 2019-12-12 01:45:25
问题 I'm trying to start a python script that waits for user input via a shell script triggered by a UDEV rule . After the input arrives the python script needs to make some database calls. I'm running into a couple different issues. Here is the udev rule: SUBSYSTEM=="usb" RUN+="/path/to/script.sh" Issue #1 - I can't seem to get it to actually open the window. Here is what I have in script.sh: #!/bin/bash lxterminal -e /path/to/python_script.py Here is the error I'm getting from udev: '/path/to

Default file permissions for FAT32 USB stick on Raspberry Pi

余生长醉 提交于 2019-12-11 19:32:44
问题 When I plug a USB stick/thumbdrive that has been formatted as FAT32 into a Raspberry Pi (running Raspbian) the file permissions default to 644 and I cannot change them. I need to leave the stick as FAT32 so it can be used back and forward to a Windows system. I have written a rule using udev but I can't get it to work. My udev rule looks like this: # Set up any USB stick for full write access KERNEL=="sd?1", MODE="0777" I determined that the rule is getting triggered because I had it renaming

Connect Moto G XT1032 by udev Ubuntu for Android Studio

六月ゝ 毕业季﹏ 提交于 2019-12-11 12:42:39
问题 I have tried: Basic tutorial in Android Developers: http://developer.android.com/intl/es/tools/device.html I think the problem is in udev rules, so I tried this: https://github.com/M0Rf30/android-udev-rules/blob/master/51-android.rules But I can't get my phone connected in Android Studio. 回答1: I'm sorry, the problem was just de configuration on the phone. I have ennable Developer options . But not USB debugging . 回答2: The procedure is fairly simple. But before you dive into the tweaking part,