Mobilehotspot

mobilehotspotd
/usr/bin/mobilehotspotd is a binary service (written in c/c++ probably), introduced in 1.3.5 but undocumented.

logs
the hotspot service seems to log to /var/log/mobilehotspotd.log

Service calls
Watch out because the program is likely to segfault when passed bad JSON arrays. Luna will return "not running" though a sysinfo will return valid information after a moment (upstart restarts it)

Methods:  sysInfo clientList setDebugLevel  interfaceAdd interfaceRemove

sysInfo

luna-send -n 1 palm://com.palm.mobilehotspot/sysInfo {}

** Message: serviceResponse Handling: 2, { "returnValue": true, "sysInfo": { "ifbridge": "bridge12", "IPv4Address": "10.1.1.11", "IPv4Subnet": "255.255.255.0", "IPv4PoolStart": "10.1.1.200", "stateBridge": "CREATED", "stateIPv4": "REMOVED", "stateDHCPServer": "DHCP SERVER STOPPED", "stateBluetoothRadio": "OFF", "interfaces": [ ] } }

setDebugLevel

luna-send -n 1 palm://com.palm.mobilehotspot/setDebugLevel '{ "debugLevel": "chatty" }'

Options for debugLevel seem to be:

chatty verbose trace info notice warning assert require error critical alert emergency tragic

To start a hotspot:

luna-send -n 1 palm://com.palm.mobilehotspot/interfaceAdd '{"wifi":{"SSID":"","Security":"WPA2Personal","Passphrase":""}}'

And to stop it:

luna-send -n 1 palm://com.palm.mobilehotspot/interfaceRemove '{"wifi":{"SSID":""}}'

Adding USB Tethering
This is so simple it hurts. The device must have the mobilehotspot service enabled.

create a file in /etc/event.d called usbtether (or however you like)

start on started mobilehotspot script echo "# sleeping a bit" sleep 5 echo "# activating usb0" ifconfig usb0 0.0.0.0 echo "# adding usb0 to bridge" brctl addif bridge0 usb0 end script
 * 1) This enables the USB tethering
 * 1) console output

The sleep 5 allows mobilehotspotd to create the bridge. One could use a more clever/robust method, but it's probably not worth it.

NOTE: The tethering is ALWAYS active, you don't need to start the Mobile Hotspot application. Actually, no. The DHCP server is not active unless Mobile Hotspot is on.

Control of BT IP Address
The mobilehotspotd binary is the source of the 10.1.1.11 IP address and subnet range used when connecting to the NAP Bluetooth Profile. This can be changed via HEX edit at address 0000a4e0 of the binary.

Below is the Hex code for the relevant area, this sets the IP address and range. Hex in bold is the 3rd octet of the IP address, in this example 10.1.1.11 and the 2nd address shown is 10.1.1.200

70 61 6c 6d 2e 62 72 69 64 67 65 00 31 30 2e 31 2e 31 2e 31 31 00 00 00 64 68 63 70 4f 62 6a 2d 3e 69 70 76 34 41 64 64 72 65 73 73 00 00 00 00 32 35 35 2e 32 35 35 2e 32 35 35 2e 30 00 00 00 64 68 63 70 4f 62 6a 2d 3e 69 70 76 34 53 75 62 6e 65 74 00 31 30 2e 31 2e 31 2e 32 30 30 00 00 64 68 63 70 4f 62 6a 2d 3e 69 70 76 34 50 6f 6f 6c 53 74 61 72 74

While it's not recommended adding digits to the binary, it should be moderately safe to change the highlighted digits to anywhere between 0 and 9.

The results of changing the highlighted digits to a hex value of 39 (decimal of 9) is as follows, and any connecting clients end up with a 10.1.9.200 address.

palm-webos-device ~ # ifconfig bridge0  Link encap:Ethernet  HWaddr Removed inet addr:10.1.9.11 Bcast:10.1.9.255  Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500  Metric:1 RX packets:118932 errors:0 dropped:0 overruns:0 frame:0 TX packets:168603 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:13127749 (12.5 MiB) TX bytes:133881439 (127.6 MiB)