59 device = device.replace(TQRegExp(
"^/.*/"),
"");
61 TQDir d(
"/sys/class/rfkill");
62 d.setFilter(TQDir::Dirs);
63 for (
int i = 0; i < d.count(); i++)
66 TQFile f(
"/sys/class/rfkill/" + d[i] +
"/name");
68 if (f.exists() && f.open(IO_ReadOnly))
70 TQTextStream stream(&f);
71 content = stream.readLine();
78 if (content.startsWith(device))
80 TQFile f(
"/sys/class/rfkill/" + d[i] +
"/index");
81 if (f.exists() && f.open(IO_ReadOnly))
83 TQTextStream stream(&f);
84 hcidx = stream.readLine().toUInt();
94 tqDebug(i18n(
"Index for the device %1 not found").arg(device));
98 struct rfkill_event event = { 0 };
100 TQFile file(
"/dev/rfkill");
101 if (!file.open(IO_ReadWrite))
103 tqDebug(i18n(
"Failed to open %1").arg(file.name()));
108 event.op = RFKILL_OP_CHANGE;
114 tqDebug(i18n(
"Bluetooth device %1 switches: idx(%2), soft(%3).").arg(device).arg(event.idx).arg(event.soft));
116 if (write(file.handle(), &event,
sizeof(event)) < 0)
117 tqDebug(i18n(
"Failed to write to %1").arg(file.name()));