Skip to content

Instantly share code, notes, and snippets.

View parthitce's full-sized avatar

Parthiban parthitce

View GitHub Profile
@parthitce
parthitce / bluez_adapter_get_properties.c
Created June 1, 2018 16:45
Get Bluetooth Adapter Properties using GDBUS
/*
* bluez_adapter_get_properties.c - Print all the properties of the controller
* - The example uses GDBUS to get the list of bluetooth controllers using DBUS
* interfaces provided by bluez
* - If any controller is found, it prints all the properites of the controller
* - GetAll method is explicitly used for Getting properties of the controller
* gcc `pkg-config --cflags glib-2.0 gio-2.0` -Wall -Wextra -o ./bin/bluez_adapter_get_properties ./bluez_adapter_get_properties.c `pkg-config --libs glib-2.0 gio-2.0`
*/
#include <glib.h>
@parthitce
parthitce / bluez_adapter_set_properties.c
Created June 3, 2018 18:18
Set powered state of the Adapter and Look for PropertiesChanged signal
/*
* bluez_adapter_set_properties.c - Set the Powered property of Adapter
* - The example uses GDBUS to set the Adapter Powered state to "on" and "off"
* in sequence.
* - It also registers signal handling for the PropertiesChanged event and prints
* the current powere state of the Adapter
* gcc `pkg-config --cflags glib-2.0 gio-2.0` -Wall -Wextra -o ./bin/bluez_adapter_set_properties ./bluez_adapter_set_properties.c `pkg-config --libs glib-2.0 gio-2.0`
*/
#include <glib.h>
#include <gio/gio.h>
@parthitce
parthitce / bluez_adapter_remove.c
Created June 9, 2018 09:20
StartDiscovery + RemoveDevice: Scan and remove the Bluetooth device
/*
* bluez_adapter_remove.c - Scan and remove bluetooth devices
* - This example scans for new devices after powering the adapter, if any devices
* appeared in /org/hciX/dev_XX_YY_ZZ_AA_BB_CC, it is monitered using "InterfaceAdded"
* signal and all the properties of the device is printed
* - Device will be removed immediately after it appears in InterfacesAdded signal, so
* InterfacesRemoved will be called which quits the main loop
* gcc `pkg-config --cflags glib-2.0 gio-2.0` -Wall -Wextra -o ./bin/bluez_adapter_remove ./bluez_adapter_remove.c `pkg-config --libs glib-2.0 gio-2.0`
*/
#include <glib.h>
@parthitce
parthitce / uhubctl_git.bb
Created September 19, 2018 17:13
bitbake recipe for uhubctl utility (git version)
DESCRIPTION = "uhubctl - USB hub per-port power control"
HOMEPAGE = "https://github.com/mvp/uhubctl"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
file://LICENSE;md5=7a7d8e0fdffe495ff61f52ceee61b2f7"
DEPENDS = "libusb1"
RDEPENDS_${PN} = "libusb1"
SRC_URI = "git://github.com/mvp/uhubctl.git"
@parthitce
parthitce / uhubctl_2.0.0-19.bb
Last active September 19, 2018 17:13
bitbake recipe for uhubctl utility (vesion 2.0.0-19)
DESCRIPTION = "uhubctl - USB hub per-port power control"
HOMEPAGE = "https://github.com/mvp/uhubctl"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
file://LICENSE;md5=7a7d8e0fdffe495ff61f52ceee61b2f7"
DEPENDS = "libusb1"
RDEPENDS_${PN} = "libusb1"
SRC_URI = "git://github.com/mvp/uhubctl.git"
@parthitce
parthitce / npm-using-https-for-git.sh
Created October 3, 2018 15:28 — forked from taoyuan/npm-using-https-for-git.sh
Force git to use https:// instead of git://
git config --global url."https://github.com/".insteadOf git@github.com:
git config --global url."https://".insteadOf git://
@parthitce
parthitce / bblayers.conf.sample
Last active October 29, 2018 09:51
repo manifest for building solidrun and samples for Yocto quick start
# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf
# changes incompatibly
POKY_BBLAYERS_CONF_VERSION = "2"
BBPATH = "${TOPDIR}"
BBFILES ?= ""
BBLAYERS ?= " \
##OEROOT##/meta-gstreamer1.0 \
##OEROOT##/meta \
@parthitce
parthitce / 0001-orange-pi-zero-Add-SPI-support-by-default.patch
Created November 10, 2018 11:25
Orange pi Zero enable SPI by default
From 3a1a3515d33facdf8ec9ab9735fb9244c65521be Mon Sep 17 00:00:00 2001
From: Parthiban Nallathambi <parthiban@linumiz.com>
Date: Sat, 10 Nov 2018 12:20:41 +0100
Subject: [PATCH] orange pi zero: Add SPI support by default
Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
---
...rm-dts-enable-SPI-for-orange-pi-zero.patch | 26 +++++++++++++++++++
recipes-kernel/linux/linux-mainline_git.bb | 1 +
2 files changed, 27 insertions(+)
@parthitce
parthitce / hci_list_gdbus.c
Last active August 22, 2020 19:19
List bluetooth controllers using GDBUS (both with and without using proxy)
/*
* hci_list_gdbus.c - List bluetooth controllers using GDBUS
* - The example uses GDBUS to get the list of bluetooth controllers using DBUS
* interfaces provided by bluez
* - If any controller is found, it prints the Name and MAC address of the controller
* gcc `pkg-config --cflags glib-2.0 gio-2.0` -o ./bin/hci_list_gdbus ./hci_list_gdbus.c `pkg-config --libs glib-2.0 gio-2.0`
* dbus-send --system --print-reply --type=method_call --dest='org.bluez' '/' org.freedesktop.DBus.ObjectManager.GetManagedObjects
*/
#include <glib.h>
@parthitce
parthitce / CMakeLists.txt
Created October 14, 2020 14:15
nrf9160 modem blocking issue
cmake_minimum_required(VERSION 3.13.1)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(nrf91-block)
target_sources(app PRIVATE src/main.c)