File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
components/dfs/filesystems/devfs Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -131,6 +131,7 @@ int dfs_device_fs_close(struct dfs_fd *file)
131131
132132int dfs_device_fs_open (struct dfs_fd * file )
133133{
134+ rt_err_t result ;
134135 rt_device_t device ;
135136
136137 if (file -> flags & DFS_O_CREAT )
@@ -186,9 +187,16 @@ int dfs_device_fs_open(struct dfs_fd *file)
186187 if (device == RT_NULL )
187188 return - DFS_STATUS_ENODEV ;
188189
189- file -> data = device ;
190-
191- return DFS_STATUS_OK ;
190+ /* to open device */
191+ result = rt_device_open (device , RT_DEVICE_OFLAG_RDWR );
192+ if (result == RT_EOK || result == - RT_ENOSYS )
193+ {
194+ file -> data = device ;
195+ return DFS_STATUS_OK ;
196+ }
197+
198+ /* open device failed. */
199+ return - DFS_STATUS_EIO ;
192200}
193201
194202int dfs_device_fs_stat (struct dfs_filesystem * fs , const char * path , struct stat * st )
You can’t perform that action at this time.
0 commit comments