zoukankan      html  css  js  c++  java
  • [quote] debugging mdev events

    1st step:

    # cat /usr/iw/printenv-hotplug
    #! /bin/sh
    exec /bin/printenv > /tmp/hotplug-env

    #chmod 755 /usr/iw/printenv-hotplug
    #echo "cat /proc/sys/kernel/hotplug"
    #cat /proc/sys/kernel/hotplug
    #echo "/usr/iw/printenv-hotplug" > /proc/sys/kernel/hotplug

    2nd step:

    # cat /proc/sys/kernel/hotplug
    /usr/iw/printenv-hotplug

    after insert usb wifi

    # cat /tmp/hotplug-env
    ACTION=add
    HOME=/
    SEQNUM=238
    DEVPATH=/bus/usb/drivers/rtusbSTA
    SUBSYSTEM=drivers
    PATH=/sbin:/bin:/usr/sbin:/usr/bin
    PWD=/
    NTERFACE=ra0
    PWD=/

    ==========================================================================

    from

    http://thread.gmane.org/gmane.linux.busybox/36199

    From: Laurent Bercot <ska-dietlibc <at> skarnet.org>
    Subject: Re: mdev with USB wifi adapters
    Newsgroups: gmane.linux.busybox
    Date: 2012-05-13 10:16:37 GMT (1 year, 34 weeks, 1 day, 9 hours and 14 minutes ago)

    > 1) Is it possible to determine more info about the device, so that we
    > can "write mdev rules"?  I'm talking manufacturer/serial#/etc.
    
     See for yourself:
    
    # cat /usr/local/bin/printenv-hotplug
    #!/bin/sh
    exec /usr/bin/printenv > /tmp/hotplug-env
    
    # chmod 755 /usr/local/bin/printenv-hotplug
    # echo /usr/local/bin/printenv-hotplug > /proc/sys/kernel/hotplug
    
     Now plug in a USB device and look at the contents of the
    /tmp/hotplug-env file. That's all the information the kernel exports
    and that is usable by udev or mdev.
    
    > 2) Is it possible to somehow determine whether the system is booting up,
    > or if it has already finished booting, and provide separate rules in
    > /etc/mdev.conf?
    
     No, but you can change /etc/mdev.conf atomically at the end of your
    init scripts. Depending on your setup, though, it might be difficult to
    ensure the original /etc/mdev.conf is restored for your next boot, even
    in the case of a dirty reboot. Better find another workaround.
    
    > I obviously do not want to apply custom rules for USB
    > sticks to  my harddrive /dev/sda, which would result in an unbootable
    > system.  A heavy-handed approach would be to set up rules for
    > (sd[b-z])([0-9]+)
    > at the top of /etc/mdev.conf.  In my case I have one built-in drive,
    > which shows up as /dev/sda.  It would be skipped by the above rule.
    
     Just have a single rule for /dev/sd* and have a
      if [ "$DEV" = "/dev/sda" ] ; exit 0
    line at the beginning of your rule script. (Maybe $DEV isn't the right
    variable name, I don't remember.)
    
    > 3) If 2) above is possible, I may need to invoke scripts, rather than
    > one-line commands.  Where would be a good place to put them?  A couple
    > of ideas for script directories are /etc/mdev.d/ and /var/lib/mdev/  Is
    > this a general thing or would it depend on the distro?
    
     Totally distro-dependent. As a rule of thumb, I like to be able to
    boot even if /var is borked, so I use /etc (on a read-only filesystem)
    for boot-time basic scripts and /var/lib for run-time advanced stuff.
    
    -- 
     Laurent
    
  • 相关阅读:
    AngularJs跨域请求Java的实现---博客园老牛大讲堂
    JavaWeb的json包装以及跨域问题--博客园老牛大讲堂
    无网络联机打单机游戏---博客园老牛大讲堂
    H5移动开发AUI框架入门---博客园老牛大讲堂
    MySql链表语句--博客园老牛大讲堂
    Jquery的基本用法--博客园老牛大讲堂
    Java的日期字符串的转换---博客园老牛大讲堂
    实现访问电脑百度,访问到自己的工程方法---博客园老牛大讲堂
    Jquery的闭包理解--匿名函数--博客园老牛大讲堂
    xampp的安装和配置与HBuilder的配置--博客园老牛大讲堂
  • 原文地址:https://www.cnblogs.com/lake-of-embedded-system/p/3510118.html
Copyright © 2011-2022 走看看