【问题标题】:micro:bit & /dev/ttyACM*on GNU/Linux systemsmicro:bit 和 /dev/ttyACM* 在 GNU/Linux 系统上
【发布时间】:2020-07-20 16:30:48
【问题描述】:

我在运行 Xubuntu 18.04.4 LTS 的笔记本电脑上连接了 micro:bit。

在我附加 micro:bit 后,XFCE4 桌面上会出现一个图标,该图标可以 用于将此设备安装到

/media/MyUserName/MICROBIT/

这样我可以将设备“BBC micro:bit CMSIS-DAP”与我的笔记本电脑配对 在我的 Google Chrome 浏览器中使用 https://python.microbit.org/v/2.0

但是在mu-editor我不能这样做,既不能使用REPL,也不能使用FILE 因为我收到了这个消息框:

"Colud 找不到连接的设备

请确保设备已插入此计算机。

它必须有一个版本的 MicroPython(或 CircuitPython)闪到它上面 在 REPL 工作之前。

最后,按下设备的重置按钮并等待几秒钟 再试一次。”

$lsusb

ID 0d28:0204 恩智浦 LPC1768

上面的这一行是附加的 micro:bit。

$ls /dev/ | grep tty

在上面命令的输出中没有 /dev/ttyACM0 或其他 ACM* 设备。

为什么外面没有 /dev/ttyACM* 这样的设备?

我怀疑 mu-editor 找不到设备,因为没有这样的设备 设备 /dev/ttyACM* 在那里。

如何解决 mu-editor 的问题?

【问题讨论】:

    标签: bbc-microbit


    【解决方案1】:

    我使用 Debian Linux。您可能需要做两件事:

    1. 我最近必须更新 micro:bits 上的固件才能继续使用 mu-editor。有关如何执行此操作的说明如下:

    [https://microbit.org/get-started/user-guide/firmware/]

    1. 安装 micro:bit。这可以通过双击显示的“MICROBIT”来完成。 Nautilus,或从命令行使用 udisksctl。请在下面找到一个名为 microbit_mount.sh 的 bash 脚本,它使用 udisksctl 来挂载和卸载 microbit。要安装 microbit,请使用以下命令:

    microbit_mount.sh 挂载

    要卸载 microbit,请使用

    microbit_mount.sh 卸载

    我将这些命令别名为 mm amd md。microbit 将出现在 /media/MICROBIT 中。您可能需要在每次刷新后重新安装 microbit。

    #!/bin/bash
    # microbit_mount.sh
    # mount and unmount microbit
    # modified from https://askubuntu.com/questions/342188/how-to-auto-mount-from-command-line
    
    BASEPATH="/media/$(whoami)/"
    MICRO="MICROBIT"
    
    if [ $# -eq 0 ]
    then
        echo "no argument supplied, use 'mount' or 'unmount'"
        exit 1
    fi
    
    if [ $1 == "--help" ]
    then
        echo "mounts or unmounts a BBC micro:bit"
        echo "args: mount - mount the microbit, unmout - unmount the microbit"
    fi
    
    # how many MICRO found in udisksctl dump
    RESULTS=$(udisksctl dump | grep IdLabel | grep -c -i $MICRO)
    
    case "$RESULTS" in
    
    0 )     echo "no $MICRO found in 'udkisksctl dump'"
            exit 0
            ;;
    
    1 )     DEVICELABEL=$(udisksctl dump | grep IdLabel | grep -i $MICRO | cut -d ":" -f 2 | sed 's/^[ \t]*//')
            DEVICE=$(udisksctl dump | grep -i "IdLabel: \+$DEVICELABEL" -B 12 | grep " Device:" | cut -d ":" -f 2 | sed 's/^[ \t]*//')
            DEVICEPATH="$BASEPATH""$DEVICELABEL"
            echo "found one $MICRO, device: $DEVICE"
    
            if [[ -z $(mount | grep "$DEVICE") ]]
            then
                echo "$DEVICELABEL was unmounted"
                if [ $1 == "mount" ]
                then
                    udisksctl mount -b "$DEVICE"
                    exit 0
                fi
            else
                    echo "$DEVICELABEL was mounted"
                    if [ $1 == "unmount" ]
                    then
                        udisksctl unmount -b "$DEVICE"
                        exit 0
                    fi
            fi
            ;;
    
    * )     echo "more than one $MICRO found"
            ;;
    
        esac
    
    echo "exiting without doing anything"
    

    【讨论】:

    • 我刚刚更新了固件,但仍然无法使用 mu-editor 使用 REPL 或使用 mu-editor 的 Files 按钮访问文件系统。
    • 我扩展了我的答案,包括如何通过 bash 脚本使用 udisksctl 安装 microbit。希望这会有所帮助。
    【解决方案2】:

    我安装了 Xubuntu 20.04,在这个系统上 mu-editor 在文件模式和 REPL 模式下工作,附带 micro:bit。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-04-17
      • 1970-01-01
      • 1970-01-01
      • 2021-09-18
      • 2014-12-15
      • 1970-01-01
      • 2017-08-09
      • 1970-01-01
      相关资源
      最近更新 更多