mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-30 14:40:12 +08:00
Suppress network configuration in discover example if it is an NSH built-in functin
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@5139 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
@@ -17,29 +17,29 @@ config EXAMPLE_DISCOVER
|
|||||||
It is also possible to address all classes with a kind of broadcast
|
It is also possible to address all classes with a kind of broadcast
|
||||||
discover.
|
discover.
|
||||||
|
|
||||||
if EXAMPLE_DISCOVER
|
|
||||||
|
|
||||||
config EXAMPLE_DISCOVER_DHCPC
|
config EXAMPLE_DISCOVER_DHCPC
|
||||||
bool "DHCP Client"
|
bool "DHCP Client"
|
||||||
default n
|
default n
|
||||||
|
depends on EXAMPLE_DISCOVER && !NSH_BUILTIN_APPS
|
||||||
select NETUTILS_DHCPC
|
select NETUTILS_DHCPC
|
||||||
select NETUTILS_RESOLV
|
select NETUTILS_RESOLV
|
||||||
|
|
||||||
config EXAMPLE_DISCOVER_NOMAC
|
config EXAMPLE_DISCOVER_NOMAC
|
||||||
bool "Use canned MAC address"
|
bool "Use Canned MAC Address"
|
||||||
default n
|
default n
|
||||||
|
depends on EXAMPLE_DISCOVER && !NSH_BUILTIN_APPS
|
||||||
|
|
||||||
config EXAMPLE_DISCOVER_IPADDR
|
config EXAMPLE_DISCOVER_IPADDR
|
||||||
hex "Target IP address"
|
hex "Target IP address"
|
||||||
default 0x0a000002
|
default 0x0a000002
|
||||||
depends on !EXAMPLE_DISCOVER_DHCPC
|
depends on EXAMPLE_DISCOVER && !NSH_BUILTIN_APPS && !EXAMPLE_DISCOVER_DHCPC
|
||||||
|
|
||||||
config EXAMPLE_DISCOVER_DRIPADDR
|
config EXAMPLE_DISCOVER_DRIPADDR
|
||||||
hex "Router IP address"
|
hex "Default Router IP address (Gateway)"
|
||||||
default 0x0a000001
|
default 0x0a000001
|
||||||
|
depends on EXAMPLE_DISCOVER && !NSH_BUILTIN_APPS
|
||||||
|
|
||||||
config EXAMPLE_DISCOVER_NETMASK
|
config EXAMPLE_DISCOVER_NETMASK
|
||||||
hex "Network Mask"
|
hex "Network Mask"
|
||||||
default 0xffffff00
|
default 0xffffff00
|
||||||
|
depends on EXAMPLE_DISCOVER && !NSH_BUILTIN_APPS
|
||||||
endif
|
|
||||||
|
|||||||
@@ -87,6 +87,11 @@
|
|||||||
|
|
||||||
int discover_main(int argc, char *argv[])
|
int discover_main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
/* If this task is excecutated as an NSH built-in function, then the
|
||||||
|
* network has already been configured by NSH's start-up logic.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CONFIG_NSH_BUILTIN_APPS
|
||||||
struct in_addr addr;
|
struct in_addr addr;
|
||||||
#if defined(CONFIG_EXAMPLE_DISCOVER_DHCPC) || defined(CONFIG_EXAMPLE_DISCOVER_NOMAC)
|
#if defined(CONFIG_EXAMPLE_DISCOVER_DHCPC) || defined(CONFIG_EXAMPLE_DISCOVER_NOMAC)
|
||||||
uint8_t mac[IFHWADDRLEN];
|
uint8_t mac[IFHWADDRLEN];
|
||||||
@@ -168,7 +173,9 @@ int discover_main(int argc, char *argv[])
|
|||||||
dhcpc_close(handle);
|
dhcpc_close(handle);
|
||||||
printf("IP: %s\n", inet_ntoa(ds.ipaddr));
|
printf("IP: %s\n", inet_ntoa(ds.ipaddr));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
#endif /* CONFIG_EXAMPLE_DISCOVER_DHCPC */
|
||||||
|
#endif /* CONFIG_NSH_BUILTIN_APPS */
|
||||||
|
|
||||||
if (discover_start() < 0)
|
if (discover_start() < 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -72,6 +72,11 @@ FAT Long File Names
|
|||||||
removable solid state media and consumer devices only using short names
|
removable solid state media and consumer devices only using short names
|
||||||
would be unaffected. ..."
|
would be unaffected. ..."
|
||||||
|
|
||||||
|
This Wikipedia entry has been updated with recent legal decisions in favor
|
||||||
|
of Microsoft. Refer to:
|
||||||
|
|
||||||
|
http://en.wikipedia.org/wiki/File_Allocation_Table#Legal_issues
|
||||||
|
|
||||||
So you have been forewarned: Use the long filename at your own risk!
|
So you have been forewarned: Use the long filename at your own risk!
|
||||||
|
|
||||||
uIP
|
uIP
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
############################################################################
|
############################################################################
|
||||||
# tools/indent.sh
|
# tools/discover.py
|
||||||
#
|
#
|
||||||
# Copyright (C) 2012 Max Holtzberg. All rights reserved.
|
# Copyright (C) 2012 Max Holtzberg. All rights reserved.
|
||||||
# Author: Max Holtzberg <mh@uvc.de>
|
# Author: Max Holtzberg <mh@uvc.de>
|
||||||
|
|||||||
Reference in New Issue
Block a user