adb工具运行python程序,红米4X手机没有反应怎么解决

本文讲述了在红米4X手机上进行开发者模式设置时,遇到Python程序无法通过USB调试执行的问题,通过ADB命令检查发现权限问题。解决步骤包括开启USB调试(需登录小米账号并插入SIM卡),并调整设备输入事件权限。
摘要由CSDN通过智能技术生成

以下情况可能会出现在红米4X机型

手机第一次连接电脑,进入开发者模式做一些必要的设置

D:\adb\py_files>adb devices
List of devices attached
SWFEMFS4TCH6IJ8S        device

可以确认电脑识别到了手机,然后就在电脑上信心满满的运行python程序,发现程序运行没有问题,但是手机一点反应都没有,这是为什么呢?

通过adb命令查看手机状态

D:\adb\py_files>adb shell
shell@nikel:/ $ ge
geomagneticd getenforce   getevent     getopts      getprop
shell@nikel:/ $ get
getenforce getevent   getopts    getprop
shell@nikel:/ $ gete
getenforce getevent
shell@nikel:/ $ getevent -p 
could not open /dev/input/event3, Permission denied
could not open /dev/input/event16, Permission denied
could not open /dev/input/event15, Permission denied
could not open /dev/input/event14, Permission denied
could not open /dev/input/event13, Permission denied
could not open /dev/input/event12, Permission denied
could not open /dev/input/event8, Permission denied
could not open /dev/input/event7, Permission denied
could not open /dev/input/event6, Permission denied
could not open /dev/input/event5, Permission denied
could not open /dev/input/event4, Permission denied
could not open /dev/input/event0, Permission denied
could not open /dev/input/event11, Permission denied
could not open /dev/input/event10, Permission denied
could not open /dev/input/event9, Permission denied
could not open /dev/input/event1, Permission denied
could not open /dev/input/event2, Permission denied

在网上千搜万搜,没有找到答案,最后只能在手机上找原因,原来是开发者选项中有一项 USB调试(安全设置) 其解释就是允许通过USB调试修改权限或模拟点击,要想开启这个功能还必须登录小米账号,通过一顿操作,注册了小米账号,竟然还需要插入SIM卡,真的是坑。。。

手机识别卡后,通过adb命令查询状态

130|shell@nikel:/ $ getevent  -p
add device 1: /dev/input/event3
  name:     "uinput-fpc"
  events:
    KEY (0001): 0001  001c  0067  0069  006a  006c  0161
  input props:
    <none>
add device 2: /dev/input/event16
  name:     "HALL"
  events:
    SW  (0005): 0000
  input props:
    <none>
add device 3: /dev/input/event15
  name:     "mtk-tpd-kpd"
  events:
    KEY (0001): 008b  009e  00ac
  input props:
    <none>
add device 4: /dev/input/event14
  name:     "mtk-tpd"
  events:
    KEY (0001): 0011  0012  0018  001f  0026  002c  002e  002f
                0032  0067  0069  006a  006c  0074  008b  009e
                00ac  014a
    ABS (0003): 0000  : value 0, min 0, max 1080, fuzz 0, flat 0, resolution 1080
                0001  : value 0, min 0, max 1920, fuzz 0, flat 0, resolution 1920
                0018  : value 0, min 0, max 255, fuzz 0, flat 0, resolution 0
                002f  : value 0, min 0, max 9, fuzz 0, flat 0, resolution 0
                0030  : value 0, min 0, max 100, fuzz 0, flat 0, resolution 0
                0031  : value 0, min 0, max 100, fuzz 0, flat 0, resolution 0
                0035  : value 0, min 0, max 1080, fuzz 0, flat 0, resolution 0
                0036  : value 0, min 0, max 1920, fuzz 0, flat 0, resolution 0
                0039  : value 0, min 0, max 10, fuzz 0, flat 0, resolution 0
  input props:
    INPUT_PROP_DIRECT
add device 5: /dev/input/event13
  name:     "m_step_c_input"
  events:
    REL (0002): 0000  0001  0002
    ABS (0003): 0008  : value 0, min 0, max 64, fuzz 0, flat 0, resolution 0
  input props:
    <none>
add device 6: /dev/input/event12
  name:     "m_mag_input"
  events:
    REL (0002): 0000  0003  0006  0007  0008  0009
    ABS (0003): 0000  : value 0, min -32768, max 32767, fuzz 0, flat 0, resolution 0
                0001  : value 0, min -32768, max 32767, fuzz 0, flat 0, resolution 0
                0002  : value 0, min -32768, max 32767, fuzz 0, flat 0, resolution 0
                0003  : value 0, min -32768, max 32767, fuzz 0, flat 0, resolution 0
                0004  : value 0, min -32768, max 32767, fuzz 0, flat 0, resolution 0
                0005  : value 0, min -32768, max 32767, fuzz 0, flat 0, resolution 0
                0006  : value 0, min 0, max 64, fuzz 0, flat 0, resolution 0
                0008  : value 0, min 0, max 64, fuzz 0, flat 0, resolution 0
  input props:
    <none>
add device 7: /dev/input/event8
  name:     "m_gyro_input"
  events:
    REL (0002): 0000  0006  0007
    ABS (0003): 0000  : value 0, min -32768, max 32767, fuzz 0, flat 0, resolution 0
                0001  : value 0, min -32768, max 32767, fuzz 0, flat 0, resolution 0
                0002  : value 0, min -32768, max 32767, fuzz 0, flat 0, resolution 0
                0008  : value 0, min 0, max 64, fuzz 0, flat 0, resolution 0
  input props:
    <none>
add device 8: /dev/input/event7
  name:     "m_acc_input"
  events:
    REL (0002): 0000  0006  0007
    ABS (0003): 0000  : value 0, min -32768, max 32767, fuzz 0, flat 0, resolution 0
                0001  : value 0, min -32768, max 32767, fuzz 0, flat 0, resolution 0
                0002  : value 0, min -32768, max 32767, fuzz 0, flat 0, resolution 0
                0008  : value 0, min 0, max 64, fuzz 0, flat 0, resolution 0
  input props:
    <none>
add device 9: /dev/input/event6
  name:     "bmi160_acc"
  events:
    ABS (0003): 0000  : value 2208, min -32768, max 32767, fuzz 0, flat 0, resolution 0
                0001  : value -5655, min -32768, max 32767, fuzz 0, flat 0, resolution 0
                0002  : value 6120, min -32768, max 32767, fuzz 0, flat 0, resolution 0
                0028  : value 0, min 0, max 0, fuzz 0, flat 0, resolution 0
  input props:
    <none>
add device 10: /dev/input/event5
  name:     "m_alsps_input"
  events:
    REL (0002): 0001  0002
    ABS (0003): 0000  : value 0, min -32768, max 32767, fuzz 0, flat 0, resolution 0
                0008  : value 0, min 0, max 64, fuzz 0, flat 0, resolution 0
  input props:
    <none>
add device 11: /dev/input/event4
  name:     "hwmdata"
  events:
    REL (0002): 0001  0002
  input props:
    <none>
add device 12: /dev/input/event0
  name:     "ACCDET"
  events:
    KEY (0001): 0072  0073  00a3  00a4  00a5  0246
  input props:
    <none>
add device 13: /dev/input/event11
  name:     "yas537_euler"
  events:
    ABS (0003): 0000  : value 0, min -2147483648, max 2147483647, fuzz 0, flat 0, resolution 0
                0001  : value 0, min -2147483648, max 2147483647, fuzz 0, flat 0, resolution 0
                0002  : value 0, min -2147483648, max 2147483647, fuzz 0, flat 0, resolution 0
                0007  : value 0, min -2147483648, max 2147483647, fuzz 0, flat 0, resolution 0
                000a  : value 0, min 0, max 3, fuzz 0, flat 0, resolution 0
  input props:
    <none>
add device 14: /dev/input/event10
  name:     "yas537_cal"
  events:
    ABS (0003): 0000  : value 0, min -2147483648, max 2147483647, fuzz 0, flat 0, resolution 0
                0001  : value 0, min -2147483648, max 2147483647, fuzz 0, flat 0, resolution 0
                0002  : value 0, min -2147483648, max 2147483647, fuzz 0, flat 0, resolution 0
                0007  : value 0, min -2147483648, max 2147483647, fuzz 0, flat 0, resolution 0
                000a  : value 0, min 0, max 3, fuzz 0, flat 0, resolution 0
  input props:
    <none>
add device 15: /dev/input/event9
  name:     "yas537_raw"
  events:
    ABS (0003): 0000  : value 0, min -2147483648, max 2147483647, fuzz 0, flat 0, resolution 0
                0001  : value 0, min -2147483648, max 2147483647, fuzz 0, flat 0, resolution 0
                0002  : value 0, min -2147483648, max 2147483647, fuzz 0, flat 0, resolution 0
                0007  : value 0, min -2147483648, max 2147483647, fuzz 0, flat 0, resolution 0
  input props:
    <none>
add device 16: /dev/input/event1
  name:     "mtk-kpd"
  events:
    KEY (0001): 0072  0073  0074  0198
  input props:
    <none>
add device 17: /dev/input/event2
  name:     "fpc_irq"
  events:
    KEY (0001): 0074  008f
    MSC (0004): 0004
  input props:
    <none>
shell@nikel:/ $
  • 17
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

随风而来j

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值