Live Note

Remain optimistic

有名管道

  1. 父进程创建一个有名管道,然后创建 1 个子进程,父进程阻塞的方式等待有名管道的信息,当读取到信息之后,在屏幕上打印出来;当从有名管道中读取到“QUIT”之后,父进程终止。
  2. 子进程 1 使用定时器,每 5 秒钟向有名管道输入“this is process 1”;当收到信号 SIGQUIT 时,向有名管道输出“QUIT”,并在屏幕上输出“process 1 exit”之后,进程终止。

提交形式

  1. 代码
  2. 运行结果截图
Read more »

要求

父进程创建 3 个进程,父进程等待子进程 2 运行完成之后,自行退出;其中子进程 1 运行系统命令“cp /bin/ls /tmp”;等待 2 秒后退出;子进程 2 使用标准 I/O 函数打开文件 src_file,向其内写入“this is process 2\n”,之后等待 5 秒后退出;子进程 3 处理为守护进程,每隔 5 秒向日志文件/var/log/messages 写入“this is process 3\n”

提交形式

  1. 代码
  2. 运行结果截图
Read more »

Linux 常用命令

  • man: an interface to the on-line reference manuals
  • su [options] [username]: change user ID or become superuser
  • useradd [options] LOGIN: create a new user or update default new user information
  • userdel [options] LOGIN: delete a user account and related files
  • passwd [options] [LOGIN]: change user password
  • ps [options]: report a snapshot of the current process.
  • kill [options] […]: send a signal to a process
  • fdisk [options] device: manipulate disk partition table
  • mount: mount a filesystem
  • chown [OPTION] … [OWNER]:[GROUP]] FILE …: change file owner and group
  • chgrp [OPTION] … GROUP FILE …: change group ownership
  • chmod [OPTION] … MODE[,MODE] … FILE …: change file mode bits
  • grep [OPTION] PATTERN [FILE…]: print lines matching a pattern
  • find [-H] [-L] [-P] [-D debugopts] [-Olevel] [starting-point…] [expression]: search for files in a directory hierarchy
  • ln: make links between files
  • gzip, gunzip, zcat: compress or expand files
  • tar: an archiving utility
  • diff [OPTION] … FILES: compare files line by line
  • patch -pnum < patchfile: apply a diff file to an original
  • ifconfig: configure a network interface

要求

  1. 程序 1 从串口读取信息,然后发到消息队列中。使用 2 个终端运行程序 1,创建出 2 个可从串口读取数据的进程,串口可以使用 Windows 中的虚拟串口,使用串口助手输入信息。
  2. 程序 2 从消息队列中读取消息,然后在屏幕上将消息内容显示出来。

提交形式

  1. 代码
  2. 运行结果截图、串口助手截图
Read more »

为什么需要无线调试

方便
无线调试可以让你在手机上进行调试,而不用连接电脑,可以节省时间。

这几天尝试使用无限调试,但是总是会有 bug,adb 死机,手机重启,导致调试失败。

1
2
# 使用 adb 6未数字码方式 连接手机
adb pair 192.168.1.100

在 Mac 下,我的手机只能成功连接一次,后续就再也连不上了

无奈,只能使用 Android Studios 调试。

  1. 使用 Android Studios 插件:ADB WI-FI
  2. USB 连接手机
  3. 打开 ADB WI-FI 面板
  4. 自动连接

这种方式目前比较稳定,可以成功连接手机,并且可以进行调试,并且每次启动都可以重新成功连接。

Update at 2025 年 03 月 10 日 16:33:15

pair 成功后, 在无线 adb 里面开启, 然后直接adb connect 192.168.1.100:5555即可连接。