Giter Site home page Giter Site logo

testjken66 / android_udev_stf_container Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nuaays/android_udev_stf_container

0.0 0.0 0.0 101.87 MB

利用udev和cgroup实现容器和安卓设备USB口 的一一映射,同时容器镜像集成stf功能方便管理安卓设备

License: MIT License

Shell 100.00%

android_udev_stf_container's Introduction

One Android Device mapping to One Docker Container using udev and cgroup

安卓USB设备与容器一一对应 snapshot

  • host udev rule setup
cp ./bin/* /usr/bin
cp -f 99-detect.rules  /etc/udev/rules.d/
service udev restart
udevadm trigger
  • android_udev_stf_container image build
docker build -t nuaays/android_stf .
  • simple docker image only with adb
nuaays/android_stf:adb
  • docker image with stf and rethinkdb
nuaays/android_stf:stf
  • launch rethinkdb using container
docker run --net=host --name=rethink -v "$PWD/rethink_data:/data" -d rethinkdb

Monitor the change on USB by udevadm monitor command

  • just get event
udevadm monitor -u --subsystem-match=usb
monitor will print the received events for:
UDEV - the event which udev sends out after rule processing

UDEV  [7720.921717] remove   /devices/pci0000:00/0000:00:11.0/0000:02:03.0/usb1/1-2/1-2:1.1 (usb)
UDEV  [7720.929956] remove   /devices/pci0000:00/0000:00:11.0/0000:02:03.0/usb1/1-2/1-2:1.0 (usb)
UDEV  [7720.932053] remove   /devices/pci0000:00/0000:00:11.0/0000:02:03.0/usb1/1-2 (usb)
UDEV  [7724.501340] add      /devices/pci0000:00/0000:00:11.0/0000:02:03.0/usb1/1-2 (usb)
UDEV  [7724.505189] add      /devices/pci0000:00/0000:00:11.0/0000:02:03.0/usb1/1-2/1-2:1.0 (usb)
UDEV  [7724.510521] add      /devices/pci0000:00/0000:00:11.0/0000:02:03.0/usb1/1-2/1-2:1.1 (usb)
  • get both event and enviroment
udevadm monitor -u --subsystem-match=usb --environment  

the result are as follows:

monitor will print the received events for:
UDEV - the event which udev sends out after rule processing

UDEV  [9202.807021] remove   /devices/pci0000:00/0000:00:11.0/0000:02:03.0/usb1/1-2/1-2:1.1 (usb)
ACTION=remove
DEVPATH=/devices/pci0000:00/0000:00:11.0/0000:02:03.0/usb1/1-2/1-2:1.1
DEVTYPE=usb_interface
ID_VENDOR_FROM_DATABASE=Google Inc.
INTERFACE=255/66/1
MODALIAS=usb:v18D1p9025d0231dc00dsc00dp00icFFisc42ip01in01
PRODUCT=18d1/9025/231
SEQNUM=8566
SUBSYSTEM=usb
TYPE=0/0/0
USEC_INITIALIZED=8475333643

UDEV  [9202.827430] remove   /devices/pci0000:00/0000:00:11.0/0000:02:03.0/usb1/1-2/1-2:1.0 (usb)
ACTION=remove
DEVPATH=/devices/pci0000:00/0000:00:11.0/0000:02:03.0/usb1/1-2/1-2:1.0
DEVTYPE=usb_interface
ID_VENDOR_FROM_DATABASE=Google Inc.
INTERFACE=8/6/80
MODALIAS=usb:v18D1p9025d0231dc00dsc00dp00ic08isc06ip50in00
PRODUCT=18d1/9025/231
SEQNUM=8565
SUBSYSTEM=usb
TYPE=0/0/0
USEC_INITIALIZED=8475332701

UDEV  [9202.828414] remove   /devices/pci0000:00/0000:00:11.0/0000:02:03.0/usb1/1-2 (usb)
ACTION=remove
BUSNUM=001
DEVNAME=/dev/bus/usb/001/011
DEVNUM=011
DEVPATH=/devices/pci0000:00/0000:00:11.0/0000:02:03.0/usb1/1-2
DEVTYPE=usb_device
ID_BUS=usb
ID_MODEL=Android
ID_MODEL_ENC=Android
ID_MODEL_ID=9025
ID_REVISION=0231
ID_SERIAL=Android_Android_724e5658
ID_SERIAL_SHORT=724e5658
ID_USB_INTERFACES=:080650:ff4201:
ID_VENDOR=Android
ID_VENDOR_ENC=Android
ID_VENDOR_FROM_DATABASE=Google Inc.
ID_VENDOR_ID=18d1
MAJOR=189
MINOR=10
PRODUCT=18d1/9025/231
SEQNUM=8567
SUBSYSTEM=usb
TYPE=0/0/0
USEC_INITIALIZED=8475321439

UDEV  [9212.816382] add      /devices/pci0000:00/0000:00:11.0/0000:02:03.0/usb1/1-2 (usb)
ACTION=add
BUSNUM=001
DEVNAME=/dev/bus/usb/001/012
DEVNUM=012
DEVPATH=/devices/pci0000:00/0000:00:11.0/0000:02:03.0/usb1/1-2
DEVTYPE=usb_device
DRIVER=usb
ID_BUS=usb
ID_MODEL=Android
ID_MODEL_ENC=Android
ID_MODEL_ID=9025
ID_REVISION=0231
ID_SERIAL=Android_Android_724e5658
ID_SERIAL_SHORT=724e5658
ID_USB_INTERFACES=:080650:ff4201:
ID_VENDOR=Android
ID_VENDOR_ENC=Android
ID_VENDOR_FROM_DATABASE=Google Inc.
ID_VENDOR_ID=18d1
MAJOR=189
MINOR=11
PRODUCT=18d1/9025/231
SEQNUM=8568
SUBSYSTEM=usb
TYPE=0/0/0
USEC_INITIALIZED=9212815498

UDEV  [9212.833764] add      /devices/pci0000:00/0000:00:11.0/0000:02:03.0/usb1/1-2/1-2:1.0 (usb)
.MM_USBIFNUM=00
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:11.0/0000:02:03.0/usb1/1-2/1-2:1.0
DEVTYPE=usb_interface
DRIVER=usb-storage
ID_VENDOR_FROM_DATABASE=Google Inc.
INTERFACE=8/6/80
MODALIAS=usb:v18D1p9025d0231dc00dsc00dp00ic08isc06ip50in00
PRODUCT=18d1/9025/231
SEQNUM=8569
SUBSYSTEM=usb
TYPE=0/0/0
USEC_INITIALIZED=9212823278

UDEV  [9212.852586] add      /devices/pci0000:00/0000:00:11.0/0000:02:03.0/usb1/1-2/1-2:1.1 (usb)
.MM_USBIFNUM=01
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:11.0/0000:02:03.0/usb1/1-2/1-2:1.1
DEVTYPE=usb_interface
ID_VENDOR_FROM_DATABASE=Google Inc.
INTERFACE=255/66/1
MODALIAS=usb:v18D1p9025d0231dc00dsc00dp00icFFisc42ip01in01
PRODUCT=18d1/9025/231
SEQNUM=8572
SUBSYSTEM=usb
TYPE=0/0/0
USEC_INITIALIZED=9212838805

Reference

android_udev_stf_container's People

Contributors

nuaays avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.