Skip to content

Instantly share code, notes, and snippets.

View pkpio's full-sized avatar
👋

Praveen Pendyala pkpio

👋
View GitHub Profile
#!/usr/bin/python
# accessory.py
# License GPLv2
# (c) Manuel Di Cerbo, Nexus-Computing GmbH
 
import usb.core
import usb.util
import struct
import time
import threading
@pkpio
pkpio / simplectrl.c
Last active August 29, 2015 13:57
This is an implementation of how to put the device to ADK mode after connecting it. After this the normal ADK procedures follow (not included). Credit: android.serverbox.ch/wp-content/simplectrl.c
/*
* simplectrl.c
* This file is part of OsciPrime
*
* Copyright (C) 2011 - Manuel Di Cerbo
*
* OsciPrime is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
Mar 5 01:12:49 beaglebone kernel: [ 5772.775156] usbcore: deregistering interface driver testusb
Mar 5 01:12:49 beaglebone kernel: [ 5772.775368] testusb: disconnect module
Mar 5 01:12:49 beaglebone kernel: [ 5703.933939] testusb: driver registered successfully
Mar 5 01:11:40 beaglebone kernel: [ 5674.526852] testusb: module deregisteredtestusb: Init called
Mar 5 01:11:40 beaglebone kernel: [ 5703.933349] testusb 1-1:1.0: usb_probe_interface
Mar 5 01:11:40 beaglebone kernel: [ 5703.933412] testusb 1-1:1.0: usb_probe_interface - got id
Mar 5 01:11:40 beaglebone kernel: [ 5703.933464] testusb: probe module
Mar 5 01:11:40 beaglebone kernel: [ 5703.933908] usbcore: registered new interface driver testusb
Verion Code Device: 2
Accessory Identification sent
Attempted to put device into accessory mode
Error setting up accessory
wget https://raw.github.com/gkaindl/beaglebone-ubuntu-scripts/master/bb-get-rcn-kernel-source.sh
chmod +x bb-get-rcn-kernel-source.sh
./bb-get-rcn-kernel-source.sh
/*
* simplectrl.c
* This file is part of OsciPrime
*
* Copyright (C) 2011 - Manuel Di Cerbo
*
* OsciPrime is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
make -C /lib/modules/3.8.0-35-generic/build M=/home/praveen/bard-linux modules
make[1]: Entering directory `/usr/src/linux-headers-3.8.0-35-generic'
CC [M] /home/praveen/bard-linux/adk-driver.o
/home/praveen/bard-linux/adk-driver.c:33:3: error: unknown field ‘owner’ specified in initializer
/home/praveen/bard-linux/adk-driver.c:33:3: warning: initialization from incompatible pointer type [enabled by default]
/home/praveen/bard-linux/adk-driver.c:33:3: warning: (near initialization for ‘testusb_driver.name’) [enabled by default]
make[2]: *** [/home/praveen/bard-linux/adk-driver.o] Error 1
make[1]: *** [_module_/home/praveen/bard-linux] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-3.8.0-35-generic'
make: *** [all] Error 2
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/usb.h>
/* Define these values to match your devices */
/* Values I found out for my phone */
#define USB_VENDOR_ID 0x04e8
#define USB_PRODUCT_ID 0x6860
/* table of devices that work with this driver */
@pkpio
pkpio / lsusb_n10
Last active August 29, 2015 14:01
lsusb -v command log
Bus 002 Device 007: ID 18d1:4ee1 Google Inc.
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x18d1 Google Inc.