Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbbfcfa1

Browse files
committed
fix(upload_reset): remove warnings raised at build time
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
1 parentb2fdadd commitbbfcfa1

File tree

1 file changed

+38
-35
lines changed

1 file changed

+38
-35
lines changed

‎src/upload_reset/unix/upload_reset.c

Lines changed: 38 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -118,44 +118,47 @@ int setDTR(unsigned short level)
118118
* Maple and Maple mini boards
119119
*/
120120

121-
main(intargc,char*argv[])
121+
intmain(intargc,char*argv[])
122122
{
123-
123+
intret=0;
124124
if (argc<2||argc>3)
125125
{
126126
printf("Usage upload-reset <serial_device> <Optional_delay_in_milliseconds>\n\r");
127-
return;
128-
}
129-
130-
if (openserial(argv[1]))
131-
{
132-
// Send magic sequence of DTR and RTS followed by the magic word "1EAF"
133-
setRTS(false);
134-
setDTR(false);
135-
setDTR(true);
136-
137-
usleep(50000L);
138-
139-
setDTR(false);
140-
setRTS(true);
141-
setDTR(true);
142-
143-
usleep(50000L);
144-
145-
setDTR(false);
146-
147-
usleep(50000L);
148-
149-
write(fd,"1EAF",4);
150-
151-
closeserial();
152-
if (argc==3)
153-
{
154-
usleep(atol(argv[2])*1000L);
155-
}
156-
}
157-
else
158-
{
159-
printf("Failed to open serial device.\n\r");
127+
ret=1;
160128
}
129+
else {
130+
if (openserial(argv[1]))
131+
{
132+
// Send magic sequence of DTR and RTS followed by the magic word "1EAF"
133+
setRTS(false);
134+
setDTR(false);
135+
setDTR(true);
136+
137+
usleep(50000L);
138+
139+
setDTR(false);
140+
setRTS(true);
141+
setDTR(true);
142+
143+
usleep(50000L);
144+
145+
setDTR(false);
146+
147+
usleep(50000L);
148+
149+
write(fd,"1EAF",4);
150+
151+
closeserial();
152+
if (argc==3)
153+
{
154+
usleep(atol(argv[2])*1000L);
155+
}
156+
}
157+
else
158+
{
159+
printf("Failed to open serial device.\n\r");
160+
ret=2;
161+
}
162+
}
163+
returnret;
161164
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp