зеркало из https://github.com/mozilla/gecko-dev.git
No bug - Revendor rust dependencies again since vcs-sync clobbered the previous revendor on a CLOSED TREE. r=me
MozReview-Commit-ID: 5RNiODURfIb
This commit is contained in:
Родитель
1d4361649f
Коммит
0a75dbc139
|
@ -1 +0,0 @@
|
|||
{"files":{".travis.yml":"6e29c10e6c5b96b621e725b7af2fef291f431a47cef81efcf51073caabe57b35","Cargo.toml":"50ad3af7147b0e6b28f9bebb22033f388b5ed518bf7da73f178cc72bd062b8b0","LICENSE":"871afd9d691846de71e0b83812ba9c7ff00bc7b3ad102dedcaa109f2246d52ad","README.md":"01b006297beb0d6ce9aff02f7df5f34a05057dce7251e805100b6b623d793502","build.rs":"c7731bfbcd76e383fe40a71de83f27793519035234434a582e7687b6a1a74712","cross-build.sh":"a903117c37fe62160eb724668e23b97a6aae3f22a41f766ce77657107970e578","examples/hwdb_query.rs":"1c730f3fa9d04ef41800971ea5931e1d109c741ab49f02db89bbebd74b95b9a8","examples/list_devices.rs":"6e9935756e3c1e5101592f54165bf968f7999e34dc5d4002d95779fc0b0eaaed","examples/monitor.rs":"e36aef4c66369ba3dbb22f6221805ee26a068dde442eddf36915ca66676c9bf7","src/lib.rs":"aab80388d2f9e53bea69f23dc514aa4acf614b25d0052ccc5996392641250952"},"package":"249a1e347fa266dc3184ebc9b4dc57108a30feda16ec0b821e94b42be20b9355"}
|
|
@ -1,23 +0,0 @@
|
|||
sudo: false
|
||||
|
||||
language: rust
|
||||
rust:
|
||||
- 1.0.0
|
||||
- stable
|
||||
- beta
|
||||
- nightly
|
||||
|
||||
matrix:
|
||||
allow_failures:
|
||||
- rust: nightly
|
||||
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- build-essential
|
||||
- libudev-dev
|
||||
|
||||
before_install:
|
||||
- pkg-config --list-all
|
||||
- pkg-config --libs libudev
|
||||
- pkg-config --modversion libudev
|
|
@ -1,19 +0,0 @@
|
|||
[package]
|
||||
name = "libudev-sys"
|
||||
version = "0.1.3"
|
||||
authors = ["David Cuddeback <david.cuddeback@gmail.com>"]
|
||||
description = "FFI bindings to libudev"
|
||||
license = "MIT"
|
||||
homepage = "https://github.com/dcuddeback/libudev-sys"
|
||||
repository = "https://github.com/dcuddeback/libudev-sys"
|
||||
readme = "README.md"
|
||||
keywords = ["udev", "hardware", "bindings", "sysfs", "systemd"]
|
||||
|
||||
build = "build.rs"
|
||||
links = "libudev"
|
||||
|
||||
[dependencies]
|
||||
libc = "0.2"
|
||||
|
||||
[build-dependencies]
|
||||
pkg-config = "0.3.2"
|
|
@ -1,20 +0,0 @@
|
|||
Copyright (c) 2015 David Cuddeback
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@ -1,80 +0,0 @@
|
|||
# Libudev Rust Bindings
|
||||
|
||||
The `libudev-sys` crate provides declarations and linkage for the `libudev` C library. Following the
|
||||
`*-sys` package conventions, the `libudev-sys` crate does not define higher-level abstractions over
|
||||
the native `libudev` library functions.
|
||||
|
||||
## Dependencies
|
||||
In order to use the `libudev-sys` crate, you must have a Linux system with the `libudev` library
|
||||
installed where it can be found by `pkg-config`. To install `libudev` on Debian-based Linux
|
||||
distributions, execute the following command:
|
||||
|
||||
```
|
||||
sudo apt-get install libudev-dev
|
||||
```
|
||||
|
||||
`libudev` is a Linux-specific package. It is not available for Windows, OSX, or other operating
|
||||
systems.
|
||||
|
||||
### Cross-Compiling
|
||||
To link to a cross-compiled version of the native `libudev` library, it's necessary to set several
|
||||
environment variables to configure `pkg-config` to work with a cross-compiler's sysroot. [Autotools
|
||||
Mythbuster](https://autotools.io/) has a good explanation of [supporting
|
||||
cross-compilation](https://autotools.io/pkgconfig/cross-compiling.html) with `pkg-config`.
|
||||
|
||||
However, Rust's [`pkg-config` build helper](https://github.com/alexcrichton/pkg-config-rs) doesn't
|
||||
support calling a `$CHOST`-prefixed `pkg-config`. It will always call `pkg-config` without a prefix.
|
||||
To cross-compile `libudev-sys` with the `pkg-config` build helper, one must define the environment
|
||||
variables `PKG_CONFIG_DIR`, `PKG_CONFIG_LIBDIR`, and `PKG_CONFIG_SYSROOT_DIR` for the *default*
|
||||
`pkg-config`. It's also necessary to set `PKG_CONFIG_ALLOW_CROSS` to tell Rust's `pkg-config` helper
|
||||
that it's okay to proceed with a cross-compile.
|
||||
|
||||
To adapt the `pkg-config` wrapper in the Autotools Mythbuster guide so that it works with Rust, one
|
||||
will end up with a script similar to the following:
|
||||
|
||||
```sh
|
||||
#!/bin/sh
|
||||
|
||||
SYSROOT=/build/root
|
||||
|
||||
export PKG_CONFIG_DIR=
|
||||
export PKG_CONFIG_LIBDIR=${SYSROOT}/usr/lib/pkgconfig:${SYSROOT}/usr/share/pkgconfig
|
||||
export PKG_CONFIG_SYSROOT_DIR=${SYSROOT}
|
||||
export PKG_CONFIG_ALLOW_CROSS=1
|
||||
|
||||
cargo build
|
||||
```
|
||||
|
||||
## Usage
|
||||
Add `libudev-sys` as a dependency in `Cargo.toml`:
|
||||
|
||||
```toml
|
||||
[dependencies]
|
||||
libudev-sys = "0.1.1"
|
||||
```
|
||||
|
||||
Import the `libudev_sys` crate and use the functions as they're defined in the native `libudev`
|
||||
library. See the [`libudev` API documention](http://www.freedesktop.org/software/systemd/libudev/)
|
||||
for more usage information.
|
||||
|
||||
```rust
|
||||
extern crate libudev_sys as ffi;
|
||||
```
|
||||
|
||||
The `libudev-sys` build script detects the presence of native `libudev` functions and exports the
|
||||
functions found to exist. `libudev-sys` exports this information from its build script, which Cargo
|
||||
will provide to the build scripts of dependent packages in the form of environment variables:
|
||||
|
||||
* `DEP_LIBUDEV_HWDB={true,false}`: The native `libudev` library has `udev_hwdb_*` functions. They will be
|
||||
exported by `libudev-sys`.
|
||||
|
||||
### Finding Help
|
||||
Since `libudev-sys` does nothing more than export symbols from the native `libudev` library, the
|
||||
best source for help is the information already available for the native `libudev`:
|
||||
|
||||
* [API Documentation](http://www.freedesktop.org/software/systemd/libudev/)
|
||||
|
||||
## License
|
||||
Copyright © 2015 David Cuddeback
|
||||
|
||||
Distributed under the [MIT License](LICENSE).
|
|
@ -1,48 +0,0 @@
|
|||
extern crate pkg_config;
|
||||
|
||||
use std::fs::{self,File};
|
||||
use std::path::Path;
|
||||
use std::process::Command;
|
||||
|
||||
use std::io::prelude::*;
|
||||
|
||||
fn check_func(function_name: &str) -> bool {
|
||||
let test_file_path = format!("target/build/check_{}.rs", function_name);
|
||||
let test_file_name = Path::new(&test_file_path[..]);
|
||||
|
||||
fs::create_dir_all("target/build").unwrap();
|
||||
|
||||
{
|
||||
let mut test_file = File::create(test_file_name).unwrap();
|
||||
|
||||
writeln!(&mut test_file, "extern \"C\" {{").unwrap();
|
||||
writeln!(&mut test_file, " fn {}();", function_name).unwrap();
|
||||
writeln!(&mut test_file, "}}").unwrap();
|
||||
writeln!(&mut test_file, "").unwrap();
|
||||
writeln!(&mut test_file, "fn main() {{").unwrap();
|
||||
writeln!(&mut test_file, " unsafe {{").unwrap();
|
||||
writeln!(&mut test_file, " {}();", function_name).unwrap();
|
||||
writeln!(&mut test_file, " }}").unwrap();
|
||||
writeln!(&mut test_file, "}}").unwrap();
|
||||
}
|
||||
|
||||
let output = Command::new("rustc").
|
||||
arg(test_file_name).
|
||||
arg("--out-dir").arg("target/build/").
|
||||
arg("-l").arg("udev").
|
||||
output().unwrap();
|
||||
|
||||
output.status.success()
|
||||
}
|
||||
|
||||
fn main() {
|
||||
pkg_config::find_library("libudev").unwrap();
|
||||
|
||||
if check_func("udev_hwdb_new") {
|
||||
println!("cargo:rustc-cfg=hwdb");
|
||||
println!("cargo:hwdb=true");
|
||||
}
|
||||
else {
|
||||
println!("cargo:hwdb=false");
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
SYSROOT=${HOME}/x-tools/armv6-rpi-linux-gnueabi/armv6-rpi-linux-gnueabi/sysroot
|
||||
|
||||
export PKG_CONFIG_DIR=
|
||||
export PKG_CONFIG_LIBDIR=${SYSROOT}/usr/lib/pkgconfig:${SYSROOT}/usr/lib/arm-linux-gnueabihf/pkgconfig:${SYSROOT}/usr/share/pkgconfig/
|
||||
export PKG_CONFIG_SYSROOT_DIR=${SYSROOT}
|
||||
|
||||
export PKG_CONFIG_ALLOW_CROSS=1
|
|
@ -1,70 +0,0 @@
|
|||
extern crate libudev_sys as udev;
|
||||
extern crate libc;
|
||||
|
||||
|
||||
#[cfg(hwdb)] use std::env;
|
||||
#[cfg(hwdb)] use std::str;
|
||||
#[cfg(hwdb)] use std::ffi::{CString,CStr};
|
||||
#[cfg(hwdb)] use libc::c_char;
|
||||
|
||||
#[cfg(hwdb)]
|
||||
fn main() {
|
||||
|
||||
let args = env::args().collect::<Vec<_>>();
|
||||
|
||||
if args.len() != 2 {
|
||||
println!("Usage: hwdb_query <modalias>");
|
||||
return;
|
||||
}
|
||||
|
||||
let query = CString::new(args[1].clone()).unwrap();
|
||||
|
||||
unsafe {
|
||||
let udev = udev::udev_new();
|
||||
|
||||
if !udev.is_null() {
|
||||
let hwdb = udev::udev_hwdb_new(udev);
|
||||
|
||||
if !hwdb.is_null() {
|
||||
query_hwdb(hwdb, &query);
|
||||
udev::udev_hwdb_unref(hwdb);
|
||||
}
|
||||
|
||||
udev::udev_unref(udev);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(hwdb)]
|
||||
unsafe fn query_hwdb(hwdb: *mut udev::udev_hwdb, query: &CString) {
|
||||
println!("{:>30}: {:?}", "query", query);
|
||||
|
||||
udev::udev_hwdb_ref(hwdb);
|
||||
print_results(udev::udev_hwdb_get_properties_list_entry(hwdb, query.as_ptr(), 0));
|
||||
udev::udev_hwdb_unref(hwdb);
|
||||
}
|
||||
|
||||
#[cfg(hwdb)]
|
||||
unsafe fn print_results(list_entry: *mut udev::udev_list_entry) {
|
||||
if list_entry.is_null() {
|
||||
return;
|
||||
}
|
||||
|
||||
let key = unwrap_str(udev::udev_list_entry_get_name(list_entry));
|
||||
let val = unwrap_str(udev::udev_list_entry_get_value(list_entry));
|
||||
|
||||
println!("{:>30}: {}", key, val);
|
||||
|
||||
print_results(udev::udev_list_entry_get_next(list_entry));
|
||||
}
|
||||
|
||||
#[cfg(hwdb)]
|
||||
unsafe fn unwrap_str<'a>(ptr: *const c_char) -> &'a str {
|
||||
str::from_utf8(CStr::from_ptr(ptr).to_bytes()).unwrap()
|
||||
}
|
||||
|
||||
|
||||
#[cfg(not(hwdb))]
|
||||
fn main() {
|
||||
println!("hwdb is not supported by native libudev");
|
||||
}
|
|
@ -1,124 +0,0 @@
|
|||
extern crate libudev_sys as udev;
|
||||
extern crate libc;
|
||||
|
||||
use std::ffi::CStr;
|
||||
use std::str;
|
||||
|
||||
use libc::c_char;
|
||||
|
||||
fn main() {
|
||||
unsafe {
|
||||
let udev = udev::udev_new();
|
||||
|
||||
if !udev.is_null() {
|
||||
enumerate_devices(udev);
|
||||
udev::udev_unref(udev);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unsafe fn enumerate_devices(udev: *mut udev::udev) {
|
||||
udev::udev_ref(udev);
|
||||
|
||||
let enumerate = udev::udev_enumerate_new(udev);
|
||||
|
||||
if !enumerate.is_null() {
|
||||
list_devices(enumerate);
|
||||
udev::udev_enumerate_unref(enumerate);
|
||||
}
|
||||
|
||||
udev::udev_unref(udev);
|
||||
}
|
||||
|
||||
unsafe fn list_devices(enumerate: *mut udev::udev_enumerate) {
|
||||
udev::udev_enumerate_ref(enumerate);
|
||||
|
||||
if udev::udev_enumerate_scan_devices(enumerate) < 0 {
|
||||
udev::udev_enumerate_unref(enumerate);
|
||||
return;
|
||||
}
|
||||
|
||||
print_devices(
|
||||
udev::udev_enumerate_get_udev(enumerate),
|
||||
udev::udev_enumerate_get_list_entry(enumerate));
|
||||
|
||||
udev::udev_enumerate_unref(enumerate);
|
||||
}
|
||||
|
||||
unsafe fn print_devices(udev: *mut udev::udev, list_entry: *mut udev::udev_list_entry) {
|
||||
if list_entry.is_null() {
|
||||
return;
|
||||
}
|
||||
|
||||
let syspath = udev::udev_list_entry_get_name(list_entry);
|
||||
let device = udev::udev_device_new_from_syspath(udev, syspath);
|
||||
|
||||
if !device.is_null() {
|
||||
print_device(device);
|
||||
}
|
||||
|
||||
print_devices(udev, udev::udev_list_entry_get_next(list_entry));
|
||||
}
|
||||
|
||||
unsafe fn print_device(device: *mut udev::udev_device) {
|
||||
udev::udev_device_ref(device);
|
||||
|
||||
println!("");
|
||||
|
||||
let initialized = udev::udev_device_get_is_initialized(device) != 0;
|
||||
let since = udev::udev_device_get_usec_since_initialized(device);
|
||||
|
||||
println!("initialized: {} usec={}", initialized, since);
|
||||
println!(" devnum: {}", udev::udev_device_get_devnum(device));
|
||||
println!(" devpath: {}", unwrap_cstr(udev::udev_device_get_devpath(device)));
|
||||
println!(" subsystem: {}", unwrap_cstr(udev::udev_device_get_subsystem(device)));
|
||||
println!(" devtype: {}", unwrap_cstr(udev::udev_device_get_devtype(device)));
|
||||
println!(" syspath: {}", unwrap_cstr(udev::udev_device_get_syspath(device)));
|
||||
println!(" sysname: {}", unwrap_cstr(udev::udev_device_get_sysname(device)));
|
||||
println!(" sysnum: {}", unwrap_cstr(udev::udev_device_get_sysnum(device)));
|
||||
println!(" devnode: {}", unwrap_cstr(udev::udev_device_get_devnode(device)));
|
||||
println!(" driver: {}", unwrap_cstr(udev::udev_device_get_driver(device)));
|
||||
|
||||
println!(" properties:");
|
||||
print_device_properties(udev::udev_device_get_properties_list_entry(device), device);
|
||||
|
||||
println!(" attributes:");
|
||||
print_device_attributes(udev::udev_device_get_sysattr_list_entry(device), device);
|
||||
|
||||
udev::udev_device_unref(device);
|
||||
}
|
||||
|
||||
unsafe fn print_device_properties(list_entry: *mut udev::udev_list_entry, device: *mut udev::udev_device) {
|
||||
if list_entry.is_null() {
|
||||
return;
|
||||
}
|
||||
|
||||
let propname = udev::udev_list_entry_get_name(list_entry);
|
||||
let propval = udev::udev_device_get_property_value(device, propname);
|
||||
|
||||
println!("{:>15}: {}", unwrap_cstr(propname), unwrap_cstr(propval));
|
||||
|
||||
print_device_properties(udev::udev_list_entry_get_next(list_entry), device);
|
||||
}
|
||||
|
||||
unsafe fn print_device_attributes(list_entry: *mut udev::udev_list_entry, device: *mut udev::udev_device) {
|
||||
if list_entry.is_null() {
|
||||
return;
|
||||
}
|
||||
|
||||
let attrname = udev::udev_list_entry_get_name(list_entry);
|
||||
let attrval = udev::udev_device_get_sysattr_value(device, attrname);
|
||||
|
||||
println!("{:>15}: {}", unwrap_cstr(attrname), unwrap_cstr(attrval));
|
||||
|
||||
print_device_attributes(udev::udev_list_entry_get_next(list_entry), device);
|
||||
}
|
||||
|
||||
unsafe fn unwrap_cstr<'a>(ptr: *const c_char) -> &'a str {
|
||||
if ptr.is_null() {
|
||||
""
|
||||
}
|
||||
else {
|
||||
str::from_utf8(CStr::from_ptr(ptr).to_bytes()).unwrap_or("")
|
||||
}
|
||||
}
|
|
@ -1,88 +0,0 @@
|
|||
extern crate libudev_sys as udev;
|
||||
extern crate libc;
|
||||
|
||||
use std::str;
|
||||
|
||||
use std::ffi::{CString,CStr};
|
||||
|
||||
use self::libc::{c_int,c_short,c_char};
|
||||
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
#[allow(non_camel_case_types)]
|
||||
type nfds_t = libc::c_ulong;
|
||||
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
#[allow(non_camel_case_types)]
|
||||
type nfds_t = libc::c_uint;
|
||||
|
||||
#[repr(C)]
|
||||
struct PollFd {
|
||||
fd: c_int,
|
||||
events: c_short,
|
||||
revents: c_short
|
||||
}
|
||||
|
||||
const POLLIN: c_short = 0x0001;
|
||||
|
||||
extern "C" {
|
||||
fn poll(fds: *mut PollFd, nfds: nfds_t, timeout: c_int) -> c_int;
|
||||
}
|
||||
|
||||
|
||||
fn main() {
|
||||
let netlink = CString::new("udev").unwrap();
|
||||
|
||||
unsafe {
|
||||
let udev = udev::udev_new();
|
||||
|
||||
if !udev.is_null() {
|
||||
let monitor = udev::udev_monitor_new_from_netlink(udev, netlink.as_ptr());
|
||||
|
||||
if !monitor.is_null() {
|
||||
listen(monitor);
|
||||
udev::udev_monitor_unref(monitor);
|
||||
}
|
||||
|
||||
udev::udev_unref(udev);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unsafe fn listen(monitor: *mut udev::udev_monitor) {
|
||||
udev::udev_monitor_ref(monitor);
|
||||
|
||||
udev::udev_monitor_enable_receiving(monitor);
|
||||
|
||||
let fd = udev::udev_monitor_get_fd(monitor);
|
||||
let mut fds = vec!(PollFd { fd: fd, events: POLLIN, revents: 0 });
|
||||
|
||||
while poll((&mut fds[..]).as_mut_ptr(), fds.len() as nfds_t, -1) > 0 {
|
||||
if fds[0].revents & POLLIN != 0 {
|
||||
let device = udev::udev_monitor_receive_device(monitor);
|
||||
print_device(device);
|
||||
udev::udev_device_unref(device);
|
||||
}
|
||||
}
|
||||
|
||||
udev::udev_monitor_unref(monitor);
|
||||
}
|
||||
|
||||
unsafe fn print_device(device: *mut udev::udev_device) {
|
||||
let seqnum = udev::udev_device_get_seqnum(device);
|
||||
let action = unwrap_cstr(udev::udev_device_get_action(device));
|
||||
let devpath = unwrap_cstr(udev::udev_device_get_devpath(device));
|
||||
let initialized = udev::udev_device_get_is_initialized(device) != 0;
|
||||
let since = udev::udev_device_get_usec_since_initialized(device);
|
||||
|
||||
println!("{}: [{}] {} (intialized={} usec={})", seqnum, action, devpath, initialized, since);
|
||||
}
|
||||
|
||||
unsafe fn unwrap_cstr<'a>(ptr: *const c_char) -> &'a str {
|
||||
if ptr.is_null() {
|
||||
""
|
||||
}
|
||||
else {
|
||||
str::from_utf8(CStr::from_ptr(ptr).to_bytes()).unwrap_or("")
|
||||
}
|
||||
}
|
|
@ -1,152 +0,0 @@
|
|||
#![allow(non_camel_case_types)]
|
||||
|
||||
extern crate libc;
|
||||
|
||||
use libc::{c_void,c_int,c_char,c_ulonglong,size_t,dev_t};
|
||||
|
||||
#[cfg(hwdb)]
|
||||
pub use hwdb::*;
|
||||
|
||||
|
||||
#[repr(C)]
|
||||
pub struct udev {
|
||||
__private: c_void,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
pub struct udev_list_entry {
|
||||
__private: c_void,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
pub struct udev_device {
|
||||
__private: c_void,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
pub struct udev_monitor {
|
||||
__private: c_void,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
pub struct udev_enumerate {
|
||||
__private: c_void,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
pub struct udev_queue {
|
||||
__private: c_void,
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
// udev
|
||||
pub fn udev_new() -> *mut udev;
|
||||
pub fn udev_ref(udev: *mut udev) -> *mut udev;
|
||||
pub fn udev_unref(udev: *mut udev) -> *mut udev;
|
||||
pub fn udev_set_userdata(udev: *mut udev, userdata: *mut c_void);
|
||||
pub fn udev_get_userdata(udev: *mut udev) -> *mut c_void;
|
||||
|
||||
// udev_list
|
||||
pub fn udev_list_entry_get_next(list_entry: *mut udev_list_entry) -> *mut udev_list_entry;
|
||||
pub fn udev_list_entry_get_by_name(list_entry: *mut udev_list_entry, name: *const c_char) -> *mut udev_list_entry;
|
||||
pub fn udev_list_entry_get_name(list_entry: *mut udev_list_entry) -> *const c_char;
|
||||
pub fn udev_list_entry_get_value(list_entry: *mut udev_list_entry) -> *const c_char;
|
||||
|
||||
// udev_device
|
||||
pub fn udev_device_ref(udev_device: *mut udev_device) -> *mut udev_device;
|
||||
pub fn udev_device_unref(udev_device: *mut udev_device) -> *mut udev_device;
|
||||
pub fn udev_device_get_udev(udev_device: *mut udev_device) -> *mut udev;
|
||||
pub fn udev_device_new_from_syspath(udev: *mut udev, syspath: *const c_char) -> *mut udev_device;
|
||||
pub fn udev_device_new_from_devnum(udev: *mut udev, dev_type: c_char, devnum: dev_t) -> *mut udev_device;
|
||||
pub fn udev_device_new_from_subsystem_sysname(udev: *mut udev, subsystem: *const c_char, sysname: *const c_char) -> *mut udev_device;
|
||||
pub fn udev_device_new_from_device_id(udev: *mut udev, id: *const c_char) -> *mut udev_device;
|
||||
pub fn udev_device_new_from_environment(udev: *mut udev) -> *mut udev_device;
|
||||
pub fn udev_device_get_parent(udev_device: *mut udev_device) -> *mut udev_device;
|
||||
pub fn udev_device_get_parent_with_subsystem_devtype(udev_device: *mut udev_device, subsystem: *const c_char, devtype: *const c_char) -> *mut udev_device;
|
||||
pub fn udev_device_get_devpath(udev_device: *mut udev_device) -> *const c_char;
|
||||
pub fn udev_device_get_subsystem(udev_device: *mut udev_device) -> *const c_char;
|
||||
pub fn udev_device_get_devtype(udev_device: *mut udev_device) -> *const c_char;
|
||||
pub fn udev_device_get_syspath(udev_device: *mut udev_device) -> *const c_char;
|
||||
pub fn udev_device_get_sysname(udev_device: *mut udev_device) -> *const c_char;
|
||||
pub fn udev_device_get_sysnum(udev_device: *mut udev_device) -> *const c_char;
|
||||
pub fn udev_device_get_devnode(udev_device: *mut udev_device) -> *const c_char;
|
||||
pub fn udev_device_get_is_initialized(udev_device: *mut udev_device) -> c_int;
|
||||
pub fn udev_device_get_devlinks_list_entry(udev_device: *mut udev_device) -> *mut udev_list_entry;
|
||||
pub fn udev_device_get_properties_list_entry(udev_device: *mut udev_device) -> *mut udev_list_entry;
|
||||
pub fn udev_device_get_tags_list_entry(udev_device: *mut udev_device) -> *mut udev_list_entry;
|
||||
pub fn udev_device_get_property_value(udev_device: *mut udev_device, key: *const c_char) -> *const c_char;
|
||||
pub fn udev_device_get_driver(udev_device: *mut udev_device) -> *const c_char;
|
||||
pub fn udev_device_get_devnum(udev_device: *mut udev_device) -> dev_t;
|
||||
pub fn udev_device_get_action(udev_device: *mut udev_device) -> *const c_char;
|
||||
pub fn udev_device_get_sysattr_value(udev_device: *mut udev_device, sysattr: *const c_char) -> *const c_char;
|
||||
pub fn udev_device_set_sysattr_value(udev_device: *mut udev_device, sysattr: *const c_char, value: *mut c_char) -> c_int;
|
||||
pub fn udev_device_get_sysattr_list_entry(udev_device: *mut udev_device) -> *mut udev_list_entry;
|
||||
pub fn udev_device_get_seqnum(udev_device: *mut udev_device) -> c_ulonglong;
|
||||
pub fn udev_device_get_usec_since_initialized(udev_device: *mut udev_device) -> c_ulonglong;
|
||||
pub fn udev_device_has_tag(udev_device: *mut udev_device, tag: *const c_char) -> c_int;
|
||||
|
||||
// udev_monitor
|
||||
pub fn udev_monitor_ref(udev_monitor: *mut udev_monitor) -> *mut udev_monitor;
|
||||
pub fn udev_monitor_unref(udev_monitor: *mut udev_monitor) -> *mut udev_monitor;
|
||||
pub fn udev_monitor_get_udev(udev_monitor: *mut udev_monitor) -> *mut udev;
|
||||
pub fn udev_monitor_new_from_netlink(udev: *mut udev, name: *const c_char) -> *mut udev_monitor;
|
||||
pub fn udev_monitor_enable_receiving(udev_monitor: *mut udev_monitor) -> c_int;
|
||||
pub fn udev_monitor_set_receive_buffer_size(udev_monitor: *mut udev_monitor, size: c_int) -> c_int;
|
||||
pub fn udev_monitor_get_fd(udev_monitor: *mut udev_monitor) -> c_int;
|
||||
pub fn udev_monitor_receive_device(udev_monitor: *mut udev_monitor) -> *mut udev_device;
|
||||
pub fn udev_monitor_filter_add_match_subsystem_devtype(udev_monitor: *mut udev_monitor, subsystem: *const c_char, devtype: *const c_char) -> c_int;
|
||||
pub fn udev_monitor_filter_add_match_tag(udev_monitor: *mut udev_monitor, tag: *const c_char) -> c_int;
|
||||
pub fn udev_monitor_filter_update(udev_monitor: *mut udev_monitor) -> c_int;
|
||||
pub fn udev_monitor_filter_remove(udev_monitor: *mut udev_monitor) -> c_int;
|
||||
|
||||
// udev_enumerate
|
||||
pub fn udev_enumerate_ref(udev_enumerate: *mut udev_enumerate) -> *mut udev_enumerate;
|
||||
pub fn udev_enumerate_unref(udev_enumerate: *mut udev_enumerate) -> *mut udev_enumerate;
|
||||
pub fn udev_enumerate_get_udev(udev_enumerate: *mut udev_enumerate) -> *mut udev;
|
||||
pub fn udev_enumerate_new(udev: *mut udev) -> *mut udev_enumerate;
|
||||
pub fn udev_enumerate_add_match_subsystem(udev_enumerate: *mut udev_enumerate, subsystem: *const c_char) -> c_int;
|
||||
pub fn udev_enumerate_add_nomatch_subsystem(udev_enumerate: *mut udev_enumerate, subsystem: *const c_char) -> c_int;
|
||||
pub fn udev_enumerate_add_match_sysattr(udev_enumerate: *mut udev_enumerate, sysattr: *const c_char, value: *const c_char) -> c_int;
|
||||
pub fn udev_enumerate_add_nomatch_sysattr(udev_enumerate: *mut udev_enumerate, sysattr: *const c_char, value: *const c_char) -> c_int;
|
||||
pub fn udev_enumerate_add_match_property(udev_enumerate: *mut udev_enumerate, property: *const c_char, value: *const c_char) -> c_int;
|
||||
pub fn udev_enumerate_add_match_tag(udev_enumerate: *mut udev_enumerate, tag: *const c_char) -> c_int;
|
||||
pub fn udev_enumerate_add_match_parent(udev_enumerate: *mut udev_enumerate, parent: *mut udev_device) -> c_int;
|
||||
pub fn udev_enumerate_add_match_is_initialized(udev_enumerate: *mut udev_enumerate) -> c_int;
|
||||
pub fn udev_enumerate_add_match_sysname(udev_enumerate: *mut udev_enumerate, sysname: *const c_char) -> c_int;
|
||||
pub fn udev_enumerate_add_syspath(udev_enumerate: *mut udev_enumerate, syspath: *const c_char) -> c_int;
|
||||
pub fn udev_enumerate_scan_devices(udev_enumerate: *mut udev_enumerate) -> c_int;
|
||||
pub fn udev_enumerate_scan_subsystems(udev_enumerate: *mut udev_enumerate) -> c_int;
|
||||
pub fn udev_enumerate_get_list_entry(udev_enumerate: *mut udev_enumerate) -> *mut udev_list_entry;
|
||||
|
||||
// udev_queue
|
||||
pub fn udev_queue_ref(udev_queue: *mut udev_queue) -> *mut udev_queue;
|
||||
pub fn udev_queue_unref(udev_queue: *mut udev_queue) -> *mut udev_queue;
|
||||
pub fn udev_queue_get_udev(udev_queue: *mut udev_queue) -> *mut udev;
|
||||
pub fn udev_queue_new(udev: *mut udev) -> *mut udev_queue;
|
||||
pub fn udev_queue_get_udev_is_active(udev_queue: *mut udev_queue) -> c_int;
|
||||
pub fn udev_queue_get_queue_is_empty(udev_queue: *mut udev_queue) -> c_int;
|
||||
pub fn udev_queue_get_fd(udev_queue: *mut udev_queue) -> c_int;
|
||||
pub fn udev_queue_flush(udev_queue: *mut udev_queue) -> c_int;
|
||||
|
||||
// udev_util
|
||||
pub fn udev_util_encode_string(str: *const c_char, str_enc: *mut c_char, len: size_t) -> c_int;
|
||||
}
|
||||
|
||||
|
||||
#[cfg(hwdb)]
|
||||
mod hwdb {
|
||||
use super::libc::{c_void,c_uint,c_char};
|
||||
use super::{udev,udev_list_entry};
|
||||
|
||||
#[repr(C)]
|
||||
pub struct udev_hwdb {
|
||||
__private: c_void,
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
pub fn udev_hwdb_ref(hwdb: *mut udev_hwdb) -> *mut udev_hwdb;
|
||||
pub fn udev_hwdb_unref(hwdb: *mut udev_hwdb) -> *mut udev_hwdb;
|
||||
pub fn udev_hwdb_new(udev: *mut udev) -> *mut udev_hwdb;
|
||||
pub fn udev_hwdb_get_properties_list_entry(hwdb: *mut udev_hwdb, modalias: *const c_char, flags: c_uint) -> *mut udev_list_entry;
|
||||
}
|
||||
}
|
|
@ -719,16 +719,15 @@ version = "0.2.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libudev-sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libudev-sys 0.1.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libudev-sys"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1668,7 +1667,6 @@ dependencies = [
|
|||
"checksum libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)" = "38f5c2b18a287cf78b4097db62e20f43cace381dc76ae5c0a3073067f78b7ddc"
|
||||
"checksum libloading 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "be99f814beb3e9503a786a592c909692bb6d4fc5a695f6ed7987223acfbd5194"
|
||||
"checksum libudev 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ea626d3bdf40a1c5aee3bcd4f40826970cae8d80a8fec934c82a63840094dcfe"
|
||||
"checksum libudev-sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "249a1e347fa266dc3184ebc9b4dc57108a30feda16ec0b821e94b42be20b9355"
|
||||
"checksum log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "880f77541efa6e5cc74e76910c9884d9859683118839d6a1dc3b11e63512565b"
|
||||
"checksum matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "efd7622e3022e1a6eaa602c4cea8912254e5582c9c692e9167714182244801b1"
|
||||
"checksum memchr 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1dbccc0e46f1ea47b9f17e6d67c5a96bd27030519c519c9c91327e31275a47b4"
|
||||
|
|
|
@ -718,16 +718,15 @@ version = "0.2.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libudev-sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libudev-sys 0.1.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libudev-sys"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1680,7 +1679,6 @@ dependencies = [
|
|||
"checksum libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)" = "38f5c2b18a287cf78b4097db62e20f43cace381dc76ae5c0a3073067f78b7ddc"
|
||||
"checksum libloading 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "be99f814beb3e9503a786a592c909692bb6d4fc5a695f6ed7987223acfbd5194"
|
||||
"checksum libudev 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ea626d3bdf40a1c5aee3bcd4f40826970cae8d80a8fec934c82a63840094dcfe"
|
||||
"checksum libudev-sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "249a1e347fa266dc3184ebc9b4dc57108a30feda16ec0b821e94b42be20b9355"
|
||||
"checksum log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "880f77541efa6e5cc74e76910c9884d9859683118839d6a1dc3b11e63512565b"
|
||||
"checksum matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "efd7622e3022e1a6eaa602c4cea8912254e5582c9c692e9167714182244801b1"
|
||||
"checksum memchr 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1dbccc0e46f1ea47b9f17e6d67c5a96bd27030519c519c9c91327e31275a47b4"
|
||||
|
|
Загрузка…
Ссылка в новой задаче