我是一个C编程新手,在这里我想检测一下Linux中是否插入了USB,我想在我的嵌入式linux设备上检测这个东西。它们都有定制的linux。所以我想要检测USB的块,在那里我必须挂载这个块。比如sda,sdb or sdc。我想用linux下的C编程来解决这个问题。
这里我有usb设备的路径/sys/bus/usb/devices,我可以看到usb的信息在这里,/sys/bus/usb/devices/1-x,所以我想获取这个usb插入位置的地址,比如sda,sdb or sdc。因此,在获取这个地址名称之后,我必须在特定的路径上挂载usb。
那么,有谁可以建议我如何检测usb是否插入?如果插
我正在写一个装配程序供练习。汇编程序使用c库函数。我特别关注fget()函数。fgets手册页声明:
fgets() reads in at most one less than size characters from stream and
stores them into the buffer pointed to by s. Reading stops after an
EOF or a newline. If a newline is read, it is stored into the buffer.
A terminating null byte ('\0&