usb_write(path, str);
This function returns the actual number of bytes read and -1 on error. If no packet was available to be read within the timeout period, this function returns 0.