Here are several fixes for the p2kmoto library.
Fixed bug with p2k_detectPhone symbol, used as function ptr instead of function for the test
Fixed bug with -l option
Added freespace and get commands (as well as quit)
Added 'const' when possible, for a cleaner API
Restricted export of global variables by using 'static'
Removed global 'devInfo' - now used only locally in one function; this fixes also a crashing bug in p2k_getDevList()
Removed some unused local variables
Fixed p2k_setP2Kmode_DARWIN() to use p2k_getATvendor() instead of p2k_getATvendor, and p2k_getATproduct() instead of p2k_getATproduct.
Now uses difftime() to compare elapsed time; comparison is also done at the end of loops, not at the beginning
Fixed bug in p2k_connect(): phoneHandle could be left with invalid value after timeout
Resets phoneHandle in p2k_closePhone()
In p2k_inpSize(), uses smaller pause, with usleep(), instead of sleep(10); no need to wait so much!
Fixed memory leak in p2k_flashMode(), p2k_suspend(), p2k_FSAC_read()
Fixed command in p2k_getPhoneModel()
Added missing cmd param size in p2k_freeSpace()
Fixed bug in p2k_FSAC_searchRequest() with request max size
Fixed bug in p2k_FSAC_read() which was not passing the right cmd param size
Fixed bug in p2k_FSAC_read(): was raising when read size was smaller than asked size; there's now a problem with the last byte
p2k_FSAC_read() now returns the number of read bytes