问题描述
安装自定义 raspberry pi os 映像后,我无法将任何捕获的映像保存到 SD 卡。在通过 raspberry pi 成像器应用程序安装之前,我使用了 Fat(适用于每个操作系统)格式。自定义 raspberry pi os 成像器提供互联网连接,无需任何设置。
这是我的功能,将捕获的图像保存到 SD 卡中。
它控制一个预定义的目录(如果存在)。除非它存在,否则它会将其打包到 SD 卡文件中。但是,运行代码后,将没有目录或保存的图像。
fun Bitmap.saveSDCard(seedlingName: String,periodRegistryDay: Int) {
try {
val path = File(FILE_PATH,FILE_NAME)
if (path.exists().not()) {
path.mkdirs()
}
val imageName = getCurrentDateTime().toEpochSecond(ZoneOffset.of(ZONE_OFFSET_VALUE))
.toString() + "" + seedlingName + "" +
periodRegistryDay.toString()
val outFile = File(path,"$imageName.jpeg")
val outputStream = FileOutputStream(outFile)
compress(Bitmap.CompressFormat.JPEG,QUALITY,outputStream)
outputStream.close()
} catch (e: Exception) {
Bugsnag.notify(e)
e.printStackTrace()
}
}
const val FILE_PATH = "/storage/self/primary"
const val FILE_NAME = "相机"
执行代码后,我检查sd卡,它说没有相关目录“/storage/self/primary”。
我尝试通过尝试访问 raspi-config 来扩展 SD 卡存储,但是即使我设法放置了 ssh 文件并尝试通过以太网或 wifi 连接进行连接,系统也不让我访问 raspberry pi。
我考虑了一下,我的假设是在自定义映像安装后,16 GB sd 卡存储空间缩小到自定义映像的大小。
如果os是raspberry pi,扩展sd卡很容易,但是自定义安装是android东西os。即使我在 sd 卡中创建了 ssh 文件,我也无法访问 raspi-config 菜单,但无法通过自定义映像安装连接 android things os 后的加载,因此我无法扩展它。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)