File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -1240,25 +1240,27 @@ function KindlePaperWhite5:init()
1240
1240
self .input .open (self .touch_dev )
1241
1241
else
1242
1242
-- Walk /sys/class/input and pick up any evdev input device with EV_ABS capabilities
1243
+ -- NOTE: Run self.input.open *outside* of the loop, as the backend code assumes fd numbers are opened in increasing order...
1244
+ local devices = {}
1243
1245
for evdev in lfs .dir (" /sys/class/input/" ) do
1244
1246
if evdev :match (" event.*" ) then
1245
1247
local abs_cap = " /sys/class/input/" .. evdev .. " /device/capabilities/abs"
1246
1248
local f = io.open (abs_cap , " r" )
1247
1249
if f then
1248
1250
local bitmap_str = f :read (" l" )
1251
+ f :close ()
1249
1252
if bitmap_str ~= " 0" then
1250
1253
logger .info (" Potential input device found at" , evdev , " because of ABS caps:" , bitmap_str )
1251
- -- Allow multiple matches, but only remember the first as touch_dev
1252
- local touch = " /dev/input/" .. evdev
1253
- self .input .open (touch )
1254
- if not self .touch_dev then
1255
- self .touch_dev = touch
1256
- end
1254
+ table.insert (devices , " /dev/input/" .. evdev )
1257
1255
end
1258
- f :close ()
1259
1256
end
1260
1257
end
1261
1258
end
1259
+ for _ , touch in ipairs (devices ) do
1260
+ -- There should only be one match on the PW5 anyway...
1261
+ self .touch_dev = touch
1262
+ self .input .open (touch )
1263
+ end
1262
1264
end
1263
1265
self .input .open (" fake_events" )
1264
1266
end
You can’t perform that action at this time.
0 commit comments