Skip to content

Include the file name to open and the fail error number #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 12, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions examples/sx127x_demo/sx127x_demo.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ static void parse_args(FAR struct args_s *args, int argc, FAR char **argv)
int nargs;
int i_value;

for (index = 1; index < argc;)
for (index = 1; index < argc; )
{
ptr = argv[index];
if (ptr[0] != '-')
Expand Down Expand Up @@ -346,22 +346,23 @@ static void print_hex(uint8_t *data, int len)
{
int i;

if(len == 0)
if (len == 0)
{
printf("empty buffer!\n");
}
else
{
for(i = 0 ; i < len ; i += 1)
for (i = 0 ; i < len ; i += 1)
{
printf("0x%02x ", data[i]);

if((i+1)%10 == 0)
if ((i + 1) % 10 == 0)
{
printf("\n");
}
}
}

printf("\n");
}

Expand Down Expand Up @@ -447,7 +448,7 @@ int main(int argc, FAR char *argv[])

/* Initialize buffer with data */

for (i = 0; i < TX_BUFFER_MAX; i+=1)
for (i = 0; i < TX_BUFFER_MAX; i += 1)
{
buffer[i] = i;
}
Expand Down Expand Up @@ -483,7 +484,8 @@ int main(int argc, FAR char *argv[])
fd = open(DEV_NAME, O_RDWR);
if (fd < 0)
{
printf("ERROR: Failed to open device!\n");
int errcode = errno;
printf("ERROR: Failed to open device %s: %d\n", DEV_NAME, errcode);
goto errout;
}

Expand Down Expand Up @@ -522,7 +524,7 @@ int main(int argc, FAR char *argv[])

clock_gettime(CLOCK_REALTIME, &tstart);

while(1)
while (1)
{
switch (args->app_mode)
{
Expand Down