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:
parent
10cf3c35b1
commit
11c061c8ed
@ -111,6 +111,24 @@ function M.access(request, response)
|
|||||||
return true
|
return true
|
||||||
end
|
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)
|
function M.status(request, response)
|
||||||
|
|
||||||
local ds = wifi.getDeviceState()
|
local ds = wifi.getDeviceState()
|
||||||
|
Loading…
Reference in New Issue
Block a user