fix bug in DynamicBtBind() causing always listen on port 1
Status: Alpha
Brought to you by:
deion
Smartcam conflicts with other bluetooth programs, because it always listens on port 1.
CommHandler.cpp:
int CCommHandler::DynamicBtBind(int sock, struct sockaddr_rc* sockaddr, uint8_t* port)
{
...
sockaddr->rc_channel = htons(*port);
...
htons(1) == 256, htons(2) == 257 etc.
sizeof(sockaddr->rc_channel) is "1" on my x86 linux. This assignment truncates hibyte.
Because of that rc_channel is always 0.
Second, in for(*port = 1; *port <= 30; *port++)
the pointer increments, not the value. This just never happens because the loop breaks on 1st iteration
patch