Remotely update devices with raspberrypi - iot

I want to know if it is possible to update old devices with help of raspberrypi remotely. The only way to update my old devices is by plugging in usb stick containg the source code and autoexec.sh file. Once I plug in the usb drive the device automatically updates and reboots. I am curious to know if I can connect my device via usb to raspberry pi, emulate a usb drive and provide those file for update?.

Related

Connecting an iPhone app to a PC app via Bluetooth

I am currently researching the possibilities of connecting an iPhone app to a windows app via Bluetooth.
The Windows App is written in C# and uses Serial ports to transfer Data. Windows allow me to connect a serial port to Bluetooth. This setup allows communication via Serial over Bluetooth.
I know this setup works because I have managed to communicate with this setup from an Android phone.
I don't seem to be able to do the same with an iPhone 5s (I can't even seem to pair the iPhone to the Windows PC). I haven't been able to test this with a more recent iPhone, but I don't expect it to work either since it's an Apple device with a Windows machine.
I've done some research regarding the possibilities of connecting an iPhone to something else (like a PC) over Bluetooth, and it doesn't seem to be possible.
I have found this SO answer which seems to say that I cannot use Bluetooth Classic to connect an iPhone to a PC.
Since I can't seem to be able to use Bluetooth Classic, I have also tried to use BLE, but I haven't worked out how to simulate the PC as a "peripheral device" to connect to it from the iPhone. I don't even know if that's possible.
So basically my questions are:
1) Is it possible to communicate via Bluetooth between an iPhone and a PC?
2) Would it be possible to use some sort of adapter for the iPhone to connect to the PC (For example, an Arduino with a Bluetooth chip, acting as a BLE peripheral, and sending the data to the PC?)
3) What alternative would I have to this? I know WiFi might work, but I am uncertain if the PC running the app will be network enabled when the project goes live.
You can connect an iPhone with PC over Bluetooth using BLE.
I tried with Linux machine (Ubuntu 16.04 with BLE dongle 4.0) which acts as BLE Peripheral and iPhone 8 with BLE 5.0 as central application. Both could able to successfully communicate using custom GATT service that we developed. The throughput i observed here was 2.5 kiloBytes per sec.
If you are so specific on Windows to act as BLE Peripheral, then i believe there are apps available in Windows store to download which enables Windows PC to act as peripheral. Once peripheral mode is enabled, you can always communicate to this over BLE using iPhone [recommended latest phones]. But you need to try this out.

Syncing vast amount of test data to iOS device

In an automated test environment, I have to use 7.5GB of test data, that consists of 170k+ files. Simply copying it with the bundle is too slow (40+ minutes), thus I would like to incrementally sync the contents of the test data folder between the iOS device and the mac. Eg. using the iOS device as a USB drive, and use rsync to sync the contents, but any ideas are welcome. No, I can't jailbreak the device. Basically I want to keep two folders synchronized between an iOS test suite and a mac. Any ideas?
There is a way to do that using USB without jailbreaking your iOS device. The whole setup works via a UNIX socket called usbmuxd that Apple uses to communicate between a USB iOS device and e.g. Xcode or iTunes on a Mac. The iOS device basically opens a TCP server and the OSX app connects to the UNIX socket from which it can obtain a TCP connection to server on the iOS device. After that you can just write and read data over USB using streams at 480MBits.
There are some frameworks under MIT license with example apps for OSX and iOS that allow you to use this mechanism in your own apps:
https://github.com/jensmeder/DarkLightning
https://github.com/rsms/peertalk
This mechanism is App Store compliant in case u need to publish your app later. One popular example is an app called Duet Display that allows you to use your iPad as a second screen via USB.
Hope that helps.

ASCII code on an external device through USB port

Is it possible to send an ASCII code on an external device through USB port using IOS API? I assume that it is possible through bluetooth connection, but I'm not sure through USB connector. Any thoughts?
I would appreciate if someone could put me in the right direction.
Thanking you in advance
That largely depends on the level of sophistication of this "external device". If this external device is just a bare metal embedded device without some sort of operating system you definitely need MFI.
Otherwise, you can run a usbmuxd server (e.g. on Raspberry PI with Linux) to establish a connection via USB. Usbmuxd is basically the technology that Apple uses to communicate between iOS devices and Desktop apps such as iTunes or Xcode. And yes, it is App Store compliant, e.g., Duet Display uses this approach to make an iPad a secondary display for your Desktop via USB.
There are several open source libraries that provide a high level API, e.g., PeerTalk or DarkLightning.

Read/Write between Mac and iPhone using libusbmuxd

I current use libimobiledevice to work around Mac and iPhone. libusbmuxd is very helpful to get device (iPhone/iPad) information when connects to Mac app through USB.
I want more, I want to read/write data (a file like document, image, video, ...) from Mac to iPhone and vice versa but I can't get any document or tutorial on the Internet guiding how to do it.
Can anyone help me
If you want to transmit data between OSX and iOS via usbmuxd it is basically a two step process:
Start a socket server on an arbitrary port on iOS or tvOS
Open a socket connection to the usbmuxd server on OSX at /var/run/usbmuxd.
After you have done that you will receive some control messages from the usbmuxd server on OSX including events for device attach and detach. Each device that has been attached to the usbmuxd server has a unique device id. This device id in combination with the port of the socket server can be used to bind the socket connection to the socket server.
If you want to save yourself the trouble of implementing this procedure from scratch you can have a look at the following frameworks. They both provide a high level API in Objective-C.
https://github.com/rsms/peertalk
https://github.com/jensmeder/DarkLightning
this is actually quite easy.
Have a further look at https://github.com/libimobiledevice
Especially look at the iFuse example.
libusbmuxd is a library to use the usbmuxd, which tunnels any socket connections on the iOS device over USB to a local socket.
On every iOS device you can find an open socket on port 62078. This is the so-called lockdownd, which is used for many things.
With lockdownd you can start the AFC service (Apple File Conduit), which is a network filesystem service.
libimobiledevice does all of this for you. (Look at libimobiledevice/afc.h, here are all filesystem related functions like reading a file, retrieving a directory, etc.)
Things you have to do:
call lockdown_client_new_with_handshake(..)
call lockdownd_start_service(..) with the "com.apple.afc" service
if your device is jailbroken, you get full filesystem access with the "com.apple.afc2" service, but otherwise the standard service should do well.
By the way: The lockdownd connection works only if your device is unlocked.
Ciao, Arno

Pocket PC not Connecting to PC

I have a Symbol PPT8800 that will not connect to Windows Mobile Device Center. It was working, I took it off the cradle, did a hard reset, and now it's not connecting. Is there a setting on the HH itself that is preventing the connection?
I have other Symbol PPT8800's that will connect in the same cradle without an issue.
There are a lot of possible sources for connection problems between a windows mobile handheld device and a PC running WMDC (ActiveSync).
use a known good USB cable
connect USB cable directly into PC and avoid USB hub
verify WMDC connects with another windows mobile device
disconnect handheld and reboot you PC and wait until PC is booted
before trying to connect
"Allow USB connections" has been deselected in WMDC Connection
Settings
sometimes the device setting "Enable advanced network functionality"
in Start/Settings/Connections/"USB to PC" has to be unchecked (or
checked).
the device has a corrupted registry and does not start the connect
(repllog.exe) or does not authenticate correctly. Do a clean boot or
wipe of the device to get the device back to factory defaults
I am sorry, but there are many possible issues that can cause a WMDC connection to fail. Recently I had the prob that after sleep/resume of my PC the USB hubs were in power save mode and I was unable to get device to connect to WMDC.
Does your PC do some 'boing' sound when you attach the USB cable to the device?
What does Hardware Device Manager show? Any exclamation marks?
EDIT: How to wipe a device?
You need to write either a small .net or c++ app using DMProcessConfigXML and the following wap provisioning xml:
<wap-provisioningdoc>
<characteristic type="RemoteWipe">
<parm name="doWipe" value="1"/>
</characteristic>
</wap-provisioningdoc>
[see also http://peterfoot.net/UsingRemoteWipe.aspx]
or use RapiConfig tool from Mobile SDK.
If both are not useable for you (is that running Windows Mobile or Windows CE?) or just restore factory default or reflash the device. If it is a device with Windows Mobile before version 5, you can just do a cold boot but delete any persistent folder first (ie Flash File Store or ???).
Factory restore of PT 8800:
hold white RESET button + POWER + FUNC

Resources