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
    
  • 相关阅读:
    C# 操作配置文件
    C# Excel操作类
    没有找到 mspdb100.dll 的解决办法
    工厂方法模式
    .Net互操作2
    The certificate used to sign “AppName” has either expired or has been revoked. An updated certificate is required to sign and install the application解决
    手机抓包xcode自带命令行工具配合wireshark实现
    expecting SSH2_MSG_KEX_ECDH_REPLY ssh_dispatch_run_fatal问题解决
    使用ssh-keygen设置ssh无密码登录
    远程复制文件到服务器
  • 原文地址:https://www.cnblogs.com/lake-of-embedded-system/p/3510118.html
Copyright © 2011-2022 走看看