0
0
mirror of https://github.com/Doodle3D/doodle3d-firmware.git synced 2024-11-18 03:27:56 +01:00

api usb info

This commit is contained in:
peteruithoven 2013-11-18 14:13:17 +01:00
parent 10cf3c35b1
commit 11c061c8ed

View File

@ -111,6 +111,24 @@ function M.access(request, response)
return true
end
function M.usb(request, response)
response:setSuccess()
local file, error = io.open("/sys/devices/platform/ehci-platform/usb1/1-1/speed",'r')
if file ~= nil then
local speed = file:read('*a')
file:close()
speed = tonumber(speed)
response:addData('speed', speed)
-- check usb device speed
-- http://stackoverflow.com/questions/1957589/usb-port-speed-linux
local highSpeed = (speed == 480)
response:addData('highSpeed', highSpeed)
end
end
function M.status(request, response)
local ds = wifi.getDeviceState()