File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -142,20 +142,24 @@ void finsh_set_prompt_mode(rt_uint32_t prompt_mode)
142142 shell -> prompt_mode = prompt_mode ;
143143}
144144
145- char finsh_getchar (void )
145+ int finsh_getchar (void )
146146{
147147#ifdef RT_USING_DEVICE
148148#ifdef RT_USING_POSIX
149149 return getchar ();
150150#else
151151 char ch = 0 ;
152+ rt_device_t device ;
152153
153154 RT_ASSERT (shell != RT_NULL );
154- if (shell -> device == RT_NULL )
155+
156+ device = shell -> device ;
157+ if (device == RT_NULL )
155158 {
156- return - RT_ERROR ;
159+ return -1 ; /* EOF */
157160 }
158- while (rt_device_read (shell -> device , -1 , & ch , 1 ) != 1 )
161+
162+ while (rt_device_read (device , -1 , & ch , 1 ) != 1 )
159163 rt_sem_take (& shell -> rx_sem , RT_WAITING_FOREVER );
160164
161165 return ch ;
Original file line number Diff line number Diff line change @@ -93,7 +93,7 @@ rt_uint32_t finsh_get_echo(void);
9393int finsh_system_init (void );
9494void finsh_set_device (const char * device_name );
9595const char * finsh_get_device (void );
96- char finsh_getchar (void );
96+ int finsh_getchar (void );
9797
9898rt_uint32_t finsh_get_prompt_mode (void );
9999void finsh_set_prompt_mode (rt_uint32_t prompt_mode );
You can’t perform that action at this time.
0 commit comments