Bluetooth decoding using GNURadio - gnuradio

I am working on developing blocks for Decoding and demodulating Bluetooth signal and then to show the sequence of 1s of 0s in demodulated signal.
I am trying to build blocks in GNURadio.
My question is : Is decoding Bluetooth previously built in GNU like photos or do we need to code it in python and build block by yourself?

My question is : Is decoding Bluetooth previously built in GNU like photos ...
Yes, gr-bluetooth is an open source OOT(out of tree) module for gnuradio that implements bluetooth.
See also Decoding Bluetooth signal and packets using GnuRadio

Related

Get macOS Output Device Audio Buffers in Realtime

I'm trying to tap the currently selected output audio device on macOS, so I basically have a pass through listener that can monitor the audio stream currently being output without affecting it.
I want to copy this data to a ring buffer in real time so I can operate on it separately.
The combination of Apple docs and (outdated?) SO answers are confusing as to whether I need to write a hacky kernel extension, can utilise CoreAudio for this, or need to interface with the HAL?
I would like to work in Swift if possible.
Many thanks
(ps. I had been looking at this and this)
I don't know about kernel extensions - their use of special "call us" signing certificates or the necessity of turning off SIP discourages casual exploration.
However you can use a combination of CoreAudio and HAL AudioServer plugins to do what you want, and you don't even need to write the plugin yourself, there are several open source versions to choose from.
CoreAudio doesn't give you a way to record from (or "tap") output devices - you can only record from input devices, so the way to get around this is to create a virtual "pass through" device (AudioServerPlugin), not associated with any hardware, that copies output through to input and then set this pass through device as default output and record from its input. I've done this using open source AudioServer Plugins like BackgroundMusic and BlackHole [TODO: add more].
To tap/record from the resulting device you can simply add an AudioDeviceIOProc callback to it or set the device as the kAudioOutputUnitProperty_CurrentDevice of an kAudioUnitSubType_HALOutput AudioUnit
There are two problems with the above virtual pass through device approach:
you can't your hear output anymore, because it's being consumed by the pass through device
changing default output device will switch away from your device and the tap will fall silent.
If 1. is a problem, then a simple is to create a Multi-Output device containing the pass through device and a real output device (see screenshot) & set this as the default output device. Volume controls stop working, but you can still change the real output device's volume in Audio MIDI Setup.app.
For 2. you can add a listener to the default output device and update the multi-output device above when it changes.
You can do most of the above in swift, although for ringbuffer-stowing from the buffer delivery callbacks you'll have to use C or some other language that can respect the realtime audio rules (no locks, no memory allocation, etc). You could maybe try AVAudioEngine to do the tap, but IIRC changing input device is a vale of tears.

QPSK Modulator Demodulator using Bladerf on GNURadio

I am working on a project to transmit and receive the binary data by using QPSK modulation and demodulation technique on GNURadio via SDR (BladeRFx40). Here is the sketch of the task to be implemented.
The flow graph is simple and workable when the intent is not to use bladeRF or is solely to modulate and demodulate binary data as the image shows
But problem arises when using osmocom source and sink (i.e. QPSK transceiver via BladeRFx40).
Few Important Questions and Problems Regarding the Working:
On the receiver side, the osmocom source(or the received signal) when tested directly using FFT plot gives no signal. How can this be made to work successfully?
Theoretically, QPSK modulation is mapping plus up-conversion, but in GNURadio, QPSK Mod block only shows mapping but no up-conversion, does the purpose of up-conversion is fulfilled itself when osmocom sink block is used(since it shows frequency at which signal is to be transmitted)? Or the up-conversion is done separately by multiplying QPSK Mod Block output with sinosoid along with osmocom sink block? Precisely how is up-conversion done on GNURadio for such a task?
If only i do modulation and demodulation without transmitting and receiving on SDR platform, then i must up-convert and down-convert it separately according to my understanding. Even then, i am unable to get the binary data: here is the attachment for it too, Kindly rectify me for any misplacement or misuse of the blocks and recommend for any changes needed in the flow graph of image.
I recommend that you visit the following link (if you have not seen it yet). When we talk about digital modulations, and these are transmitted / received by a USRP, HackRF, etc., the recovery of the signal is not as easy as in FM or AM.
I do not fully understand your question because I just entered the world of SDR, but in the sdr sinks (UHD or OSMOCON) is where the RF frequency is configured (M / GHz).
If you want to simulate the TX / RX process, you do not need to configure the RF frequency because it will not transmit this signal to the air. You will be working in Baseband

how the usb spi flashing device write program to atmega?

the atmega microcontrollers have the internal programmable memory.So the usb flash device write data to internal memory of atmega through spi or it store the program and works as slave?i also want to know can the atmega get program,file in the MicroSD and run without internal memory or it need to run a program in internal disk then including the program in MicroSD?i don't know how the process work in atmega microcontroller.
There are several ways to program the AVR:
Using an external programmer. The Chip is in reset state during this. Then the programmer uses special a special protocol to directly write to the flash inside the controller. This is how your USB programming device probably writes code to the AVR. There are several protocols for this, but the most common one uses the same pins that are used by SPI. You should not confuse them just because of that ;-).
The controller writes the program itself. The chip is actively executing a program. That program on the chip fetches the instructions from e.g. a sd card and using the SPM instruction to copy it to local flash.
The AVR can only fetch instructions from it's own flash memory - you cannot execute directly from RAM or from any other external source.
The best answer for this question you can find at the end or middle of datasheet for AVR device (eg ATMEGA 328P-PU). If you are using some flashing device connected with computer, there is some initialization sequence after start and then there are send some 4 Bytes commands that tels microcontrolers, where to store values to flash and/or eeprom, fuse bits, or cares about erasing etc. There is also posible to read ID of chip.
Atmega microcontroler can be also programmed in paralel mode, where are some bits used for sending commands that tels, what to do with data on data bit.
If you ask about downloading program from SD card or any other device, there is possible to write to the flash through SPM, as there was told above. Some devices do not have part of flash for downloader - if I remember ATMEGA 48, and devices, that have configurable part of memory usable also for downloader, that can handle this, eg. ATMEGA 88, 168, 328. So if you want to download program from SPI, USART, TWI, etc, you need to configure fuse bits and create downloader that will do it for you. I am not sure, how ATMEGA 48 do this, but there si probably possible to write whole flash by SPM instruction.
However the best answer you can find in the datasheet. On pages folowing 255 you can find further information. http://www.atmel.com/images/Atmel-8271-8-bit-AVR-Microcontroller-ATmega48A-48PA-88A-88PA-168A-168PA-328-328P_datasheet_Complete.pdf

Teensy to imitate a USB bulk data transfer

I've purchased a teensy 3.0 in the hope I can use it to imitate the USB bulk transfer from another piece of hardware.
I am developing some software to read and process the data coming over USB in a bulk transfer
But I am trying to do this prior to actually having the USB device to test against
Hence I thought I could imitate the actual device by having a teensy send a few representative packets over the USB instead.
I know the USB packet format so can knock up a few char arrays with the expected binary format. I'd then have write a program (hopefully in C as thats what I know) that encapsulates those char buffers and then tries to send them as a bulk transfer over USB, probably using libusb I think. I'd have to build and load this on to the teensy using the correct build tool (avr-gcc and halfkay?) and then plug in the teensy and hope it behaves like the device i am trying to simulate
does this sound feasible/possible?
can anyone suggest what the code might look like or any good tutorials? I'm so new to this I don't even know what to search for.
Might it be the case that I have to learn 'arduino' as opposed to being able to write the program in C?
First let me clear what I understand from your question.
You are creating a software that can analyse any data that can come over USB.
You are trying to use Teensy to send data to USB and then process it.
Now the answer for feasibility lies in the compatibility of your software. If your software is able to read data from a USB that is initialized as a COM Port, then and only then your software wold be able to read that data.
This is because both Teensy and Arduino uses USB port with a FTDI chip that communicates with all the other devices as a serial communicator. This is a small chip near the USB port.
Now if your software is able to read data from a COM port, then when programming the Teensy, you just have to use usb_serial_write() function with a loop. You can get more help over here.
But if your software is not able to read from a serial COM port, there are many other applications such as Teraterm to store received data to a file. You can then use this file extract the data and process it.

How to write usb touchscreen driver kext in os x 10.9?

I want to write a usb touchscreen kext for usb touch screen .
I have read the Kernel Extension Programming Topics and the I/O Kit Fundamentals etc,
My question is,
1 . how to get the input report messages from touch screen ?
2 . how to post the coordinate info to system ?
I have no idea, anybody help?
It depends on the hardware; moreover, this question is quite broad - you'll need to be more specific in your question to get more specific answers. I'll try to provide a broad overview:
A touchscreen has 2 parts:
Output: showing the image coming from the computer on the display
Input: the touch events to feed back into the computer
As you haven't asked about (1) at all, I assume your device just plugs into a display port on the Mac and is already displaying correctly. If not, you'll want to look into the IOFramebuffer API.
For (2) - Pretty much all USB input devices are HID devices of some form. If you're new to HID in general, you'll probably want to read and understand the USB HID specification and related documentation as you'll be using that information throughout.
OSX already comes with comprehensive support for the standard HID device classes such as keyboards, mice, touchpads, graphics tablets, etc. If your device claims to be any kind of HID device, OSX should already be detecting it and attaching its generic HID driver to it. You should see a IOUSBHIDDriver instance in the I/O Registry (eg. using Apple's IORegistryExplorer tool, or ioreg on the command line).
I'd also expect your device to conform to HID's absolute pointing device profile, so at least single touches should already be working properly. If it's a multitouch device, or you need other extra features, you'll probably want to implement a IOUSBHIDDriver subclass that generates or converts the necessary multitouch events.
If your device for some reason isn't already a HID USB device, you'll need to write a custom USB driver for it, and convert the events coming from it into HID events, as the HID events are passed directly into userspace and processed there. You can actually write USB drivers and generate HID events from userspace, so you might be able to avoid writing any kernel code at all if you prefer.
Apple provides some documentation on HID:
The HID Class Device Interface Guide covers some general concepts and the userspace interfaces.
The Kernel Framework Reference has API documentation for the various IOHID* classes in the kernel.
If you're going to be writing your own kernel HID device driver, your best bet is probably the IOHIDFamily source code. You can probably also find some open source examples around the web.
Apple's USB mailing lists is probably also worth checking, both for the archives and if you have questions. The darwin-kernel and darwin-drivers lists are also relevant.