KallistiOS
KallistiOS copied to clipboard
INIT_NET issues
I was playing around with @darcagn's httpd-ack-next repo and I noticed that when using the INIT_NET flag in KOS_INIT_FLAGS(INIT_DEFAULT | INIT_NET); it would show a black screen for 45-60 seconds before showing the main screen. Looking at the code I found that KOS was trying to establish a DHCP connection which Im not setup for so it takes 45-60 secs to fail before it goes to showing the main screen of the repo. By updating this portion of net_init() from
if(net_default_dev) {
/* Did we get a requested IP address? this normally happens over dcload-ip. */
if(ip) {
rv = net_dhcp_request(ip);
if(rv < 0) {
dbglog(DBG_DEBUG, "Failed to acquire the specified IP with DHCP\n");
/* If that fails, set the address manually. Although gateway
and dns etc. will also manually need setting */
net_ipv4_parse_address(ip, net_default_dev->ip_addr);
rv = 0;
}
}
/* We didn't get a requested IP address, if we don't already have one
set, then do so via DHCP. */
else if(!net_default_dev->ip_addr[0])
rv = net_dhcp_request(0);
}
to this:
if(net_default_dev) {
/* Did we get a requested IP address? this normally happens over dcload-ip. */
if(ip) {
/* Set the address manually. Although gateway
and dns etc. will also manually need setting */
net_ipv4_parse_address(ip, net_default_dev->ip_addr);
rv = 0;
}
/* We didn't get a requested IP address, if we don't already have one
set, then do so via DHCP. */
else if(!net_default_dev->ip_addr[0])
rv = net_dhcp_request(0);
}
the main screen shows up within 2-3 seconds of upload using dcload-serial. I have a question (as a networking noob):
Why do we do a call to net_dhcp_request(ip); when given an IP when it can also be set manually? For people that are not setup for DHCP, it blocks the main thread and we have 45-60 seconds of black screen before it times out and sets it manually.
Tagging experts and people Ive talked with this about: @Kazade @darcagn @gyrovorbis