Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void
- bluetooth_killswitch_set_state (BluetoothKillswitch *killswitch,
- KillswitchState state)
- {
- BluetoothKillswitchPrivate *priv = BLUETOOTH_KILLSWITCH_GET_PRIVATE (killswitch);
- struct rfkill_event event;
- ssize_t len;
- g_return_if_fail (state != KILLSWITCH_STATE_HARD_BLOCKED);
- memset (&event, 0, sizeof(event));
- event.op = RFKILL_OP_CHANGE_ALL;
- event.type = RFKILL_TYPE_BLUETOOTH;
- if (state == KILLSWITCH_STATE_SOFT_BLOCKED)
- event.soft = 1;
- else if (state == KILLSWITCH_STATE_UNBLOCKED)
- event.soft = 0;
- else
- g_assert_not_reached ();
- len = write (priv->fd, &event, sizeof(event));
- if (len < 0)
- g_warning ("Failed to change RFKILL state: %s",
- g_strerror (errno));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement