USB / IR port controll

Does anyone know how to control (read/write) to the USB or IR port?