Query OS for hardware characteristics of wireless adapters - raspberry-pi

I have a raspberry pi with 2 wireless adapters connected to it - one has an antenna.
http://www.modmypi.com/raspberry-pi/accessories/wifi-dongles/wifi-dongle-ultra-long-range-high-gain-w-5dbi-antenna
I am trying to write a script that queries my linux box for wireless interfaces, finds out which one is the one which has the antenna connected and put it into hotspot mode. Tomorrow, it can be any other adapter with an antenna attached.
Are there any tools or commands that can help?
Any entries in /proc or /sys that tell me this is the required device?
Thanks in advance.
EDIT:
Is there a CLI that gives the interface name and the Manufacturer and model?

To know what wifi cards you have plugged in your system, run "iwconfig".
For the antenna, there is no way to know if your dongle has the antenna plugged on, or the antenna has been removed.
I guess, the best workaround could be, query the device for a network scan - then you count how many APs were found: if the antenna has been unplugged, you will not get any APs (or maybe only 1-2...)

I ended up using hwinfo on my pi and doing the text/regex parsing in python to get all the data I was interested in.

Related

STM-Link on Nucleo Board Not Enumerating

I have two nucleo boards (F4339ZI and F303K8) and neither of them show up as USB devices when I plug them into a computer via the USB port (CN1 - the USB micro port on the ST-Link, not the USB port for the board itself).
I have tried multiple host USB ports, with and without a USB hub, across two different computers, one running OS X and one running Linux. I have tried at least 6 different cables. The OSX machine is using a USB-C to USB-A converter (if that's the correct terminology). The Linux machine has USB-A ports.
In no case does the device show up using lsusb under Linux or system_profiler SPUSBDataType under OSX. Needless to say STM32CubeIDE and st-info can't see the boards. Other USB devices are functional.
The COM LED is slow blinking red which the manual (https://www.st.com/resource/en/user_manual/dm00244518-stm32-nucleo144-boards-stmicroelectronics.pdf) says means USB enumeration hasn't completed (matching what is seen from the OS level).
The boards successfully run their factory supplied blink programs when powered on.
I have tried (with the F4395I) moving JP3 to VIN so the board doesn't power up which should just leave the ST-Link running - still no enumeration though.
I tried connecting to a USB charger with JP1 off (and JP3 on U5V) and the board powers up and blinky runs. The manual referenced above says:
In case the board is powered by a USB charger, there is no USB enumeration, so the green LED LD6 stays in OFF state permanently and the target STM32 is not powered.
But everything works for me - LD6 goes a steady green as it does when connected to a computer.
Given it happens with multiple computers, OSs, cables and Nucleo boards I assume the error lies with me, the common factor in all the tests. This is my first use of Nucleo boards so I may well have a mis-assumption.
Out of frustration and lacking anything else to try I dug up every micro USB cable I could find. One had chokes on each end and magically, using that cable, everything just works as expected.
Can it be that I have at least 10 broken USB cables? I don't have an easy way to test them but I guess they might not have the data lines wired to save cost if manufacturers assumed people would only charge phones with them. I don't recall where they all came from...they have just accumulated in a box of USB cables.
Perhaps the Nucleo board sensitive to some horrible interference floating around my room?
Sorry for the noise! Broken cable was genuinely one of the things I suspected - but not 6 of them...

pi-zero usb otg port identified as unknown device during boot

I currently have a pi zero which acts as a bluetooth keyboard which - when attached to a computer - types text read from the SD card. I followed this tutorial https://www.rmedgar.com/blog/using-rpi-zero-as-keyboard-setup-and-device-definition. I use only the USB "Data" port, to power it up and to send data.
This setup works really fine on nearly all computers I tested it on, just on some Windows 7 systems it is not working at all. The system where it is not working on identify the pi zero as "Unknown device" and then never "re-identify" it as the keyboard which it is supposed to be.
All other systems first identify the device as "Unknown device" and after some seconds "re-identify" it as the actual keyboard. IMO the problem is the one mentioned by scruss in this post: https://raspberrypi.stackexchange.com/questions/60056/cant-see-raspberry-pi-zero-via-usb-otg-on-windows-10
I'm looking for a possibility to fix this problem. Is there some possibility to configure the pi zero in a way that during boot it does not identify as any USB device. Maybe that during boot the data USB port acts only as a power USB port.
Or can I turn the USB port off and on after a boot so that form the computers point of view it looks like the usb devices is removed and reattached??
I fixed that with the help of a colleague.
The solutions seems super simple - just remove the usb gadget and add it again.
The code necessary is equally simple:
#Remove usb gadget
echo "" > UDC
#Add it again
ls /sys/class/udc > UDC

Extending Wifi/WLAN Range with one NIC on a Laptop

I plan to extend the range of my Wifi with my Notebook. - My question to this, is it possible to build a wireless repeater with only one NIC? or do I really need at least two NICs, one for being logged in and receiving the packets and the other for extending the WiFi/Signal. - Actually, what I wanna do is, using my laptop as a WiFi-Repeater, but only with the built-in NIC, no second one.
I've searched the net already but found nothing about the functionality of a WiFi-Repeater and if they have two NICs integrated.
Hope you guys can enlight me ;)
EDIT(added schemes):
Possibility A
Possibility B
What can be achieved with an AP capable Chip/Firmware, for instance, the Ath9k.
You can't turn laptop's WiFi into range extender, since I believe it requires a special WiFi chip firmware and a special configuration of antenna(s).
However, you might try to look on the internet if WiFi chip you have supports AP mode in firmware (not all manufacturers provides that), and if yes, you can set up the access point with the same SSID. In this case your WiFi clients will roam from one AP to another. Of course, this kind of setup requires Ethernet cable attached to your laptop.

How to send data to iPhone from external device

I have an external device that we manufacture that basically monitors 4 voltages, converts them to a 16 bit digital number then streams this info back to a PC every 100mS or so, using a serial over USB style chip. Basically a data logging system.
We would now like to collect this information on an iPhone and I am wondering what is the best way to get the data into the iPhone?
I am assuming there is no way we can physically connect directly to the iPhone dock connector as the protocol to do this is not available to iOS developers?
Obviously we could do it over a WiFi network but there will not always be one and we want to keep the external hardware fairly simple, i.e. no need for a computer or Wireless router etc.
If we add Bluetooth connectivity to our hardware would this work? I read that only 'Made for iPod' type Bluetooth devices will connect, in which case how can we achieve 'made for iPod' status? It would be relatively easy to add the necessary Bluetooth chips to get the system up and running.
In an ideal world we would like to do this without having to use a 3rd party interface.
I have been thinking about trying to digitise data as an audio signal – like a modem, and send it into the line input jack, but I don’t think it will be fast enough – this would be new territory for me.
Anyway all suggestions gratefully received!
Thanks!

Debugging an iOS app with an external accessory connected via Dock

Am I missing something glaringly obvious or is there no way to debug an iOS app which uses an external accessory that's connected via the 30-pin dock without using a bucket load of logs etc. I want to be able to use things such as breakpoints and Instruments.
Is there a way to remote debug perhaps, over Wi-Fi, Bluetooth?
Note: Yes, I asked this very recently and I deleted it because I thought I found the answer.. but the answer was only Instruments has support over Wi-Fi.. not Xcode debugging. So the question still remains...
And so...: Given that I've had no real luck finding the answer, and no one has given me an answer as yet - I take it that it is a big fat NO. :(
Makes me wonder are we just expected to magically guess where bugs occur, or log the crap out of everything while wearing out our dock connectors by continuously moving it back and forth between the device and accessory?
Time to file a bug report I guess.
At CES today, I talked to a developer from Wahoo Fitness that makes an ANT+ accessory for iPhone. They had this same problem, but found a solution.
They found a pass-through dock extender that has a mini-USB port. They used the mini-USB port for debugging while the accessory was connected.
The product they were using is http://www.cablejive.com/products/dockStubz.html
This blog talks about remote debugging iOS with a dock accessory attached
You could connect the external accessory to another iOS device (not the one tethered to the Mac running the Xcode debugger). Then tunnel all your EA framework messages from the accessory connected device to the device running the app being debugged over a pair of wifi sockets. Look at the code for tunneling accelerometer messages from a device to the iOS Simulator (a common trick for debugging game code on the Simulator) for one example of how this could be done.
After further researching, and having seen that people had to do sending strings over Wi-Fi to get around this, I'm concluding the answer is no.
I have filed a bug request for this.
In the mean time, it seems like the Wi-Fi logging, and on-device text logging will be the way to go for now.
Here's my understanding for why just the USB protocol works for some external accessories and doesn't for other external accessories. Looks like a fundamental problem, without an arbitrator, two masters can't talk to a single slave over USB, a serial Master/Slave protocol. So XCode is one master, the iPhone is the slave device. If the external accessory is a master too, one won't be able to connect the iPhone (Xcode slave) to the second master (the external accessory).
Probably the Wahoo Key for iPhone" is a slave device and that's why the dockStubz solution works for such an external accessory.
I have tested the dockStubz. It doesn't work for my external accessory. As suspected, the USB protocol can't be used to have two Master devices controlling a single slave device. Trying to hook up a Mac (Master) (via the mini USB ) & an external accessory (Master) (via the 30 pin connector) to the iPhone 4 (Slave) causes the iPhone to go in loop of connect & re-connect.
Following looks promising too, though expensive: digi.com/support/kbase/kbaseresultdetl.jsp?id=485.
Has any one tried to use USB to Ethernet connectors and use a router to route requests from two masters (XCode & External Accessory) to the slave (iPhone)? I am off to Best Buy to purchase USB to Ethernet cables and hook all three on to my IP router. Will report if it works.
This is what will be needed :
http://www.bestbuy.com/site/IOGEAR+-+USB+Ethernet+Extender/9614781.p?id=1218131339965&skuId=9614781&st=USB%20to%20Ethernet&cp=1&lp=1
http://www.frys.com/product/6103339
So connect XCode mac using the male end into the USB slot of your computer. . Use a ethernet cable to connect this to a router.
Connect the iPhone to the female part of the IO gear connector. Connect it to the router via ethernet cable.
Connect the external accessory with the male connector (Sabrent USB to Fast Ethernet Network Adapter.) Connect it to router.
I am still researching if this will work. Just ordered the parts. Will get it by Friday & will report back then.
Update:
The IOGear male end draws too much current when connected to router. Also, the female end can't charge iPhone when connected to the router even when 5V USB current supplied.
So tried to directly connect the iPhone to the USB slot of the router (used for printers). It does charge the iPhone. Also used USB to Fast Ethernet Network Adapter (BestBuy had one to connect Wii via USB) to connect the Mac to the router. It did connect to internet but couldn't find the iPhone. In the router client list I don't see any login entires for the iPhone. So this experiment was a failure unless someone have other pointers.