Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

15
LINES

< > BotCompany Repo | #555 // Stefan's tablet detect

Lua code

1  
-- detects if tablet is connected to notebook (run on notebook)
2  
3  
get("#515") -- splitLines
4  
5  
bla = os_backtick('usb-devices')
6  
lines = splitLines(bla)
7  
8  
for _, line in ipairs(lines) do
9  
  if line:match("S:%s+Manufacturer=SurfTab") then
10  
    print("Tablet connected!")
11  
    return
12  
  end
13  
end
14  
15  
print("Tablet not connected!")

Author comment

Began life as a copy of #554

test run  test run with input  download  show line numbers   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, znullqslnikg

3 comment(s) hidden. show

Snippet ID: #555
Snippet name: Stefan's tablet detect
Eternal ID of this version: #555/1
Text MD5: d926cf09205cca1d8fc4c2568fa60447
Author: stefan
Category:
Type: Lua code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-04-01 20:49:33
Source code size: 329 bytes / 15 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 1928 / 451
Referenced in: [show references]