Connect two BBB to one PC using USB - python

My question is how to connect two BBB (Beagle Bone Black) into one PC using USB and communication with them at the same time.
I am trying to write a python script that two BBB boards to communicate with each other. The idea is that these boards should communicate with each other using iperf and an external cape (OpenVLC).
The problem is that I need to use the iperf on the server-side and then read the data on the client-side.
For this purpose, I need to connect them to one PC to be able to read commands and write the results.

##USB_NETWORK_DISABLED=yes
###To Run Multple Boards on one USB HOST, change the 3rd octal on every
###USBx_SUBNET define and USBx_ADDRESS
###BeagleBone Number 2: USB0: 192.168.11.2 USB1: 192.168.10.2
###BeagleBone Number 3: USB0: 192.168.13.2 USB1: 192.168.12.2
###And So On..
This is from bb-boot on the images from rcn-ee.net/com.

That's going to be a struggle. Both BBB grab the same IPs (192.168.6.2 and/or 192.168.7.2 depending on your PC's operating system) on their virtual Ethernet adapters and assign the same address to the PC side (192.168.6.1 and/or 192.168.7.1). You can change that in the startup scripts (google for details). Then you'd need to set your PC up to route traffic between the two which depends on your operating system. If you haven't done networking before, it's going to be hard.
Instead of USB, I'd strongly recommend connecting all devices to a simple router box using Ethernet. It just works.

Related

Finding IP address of another computer on LAN in python

I'm trying to use socket to exchange data between two computers in Python. Right now, I'm able to connect the computer together but I have to manually go in the code and specify the IP address of the other computer. However the code needs to be fully autonomous on boot. How should I do that? Is there a way in python to achieve this? Thanks.

How To Find Out What Router/Switch ANOTHER Computer Is Connected To

This is somewhat of a repost from Is there a way to find out the BSSID a computer is connected to in a local network? but there was no answer there so I will try to quantify more specifically what I am trying to do here.
I'm working on a project for my job where we have a very large network. The goal is to be able to guesstimate on a map where a given machine is on the campus by finding out what AP the device is connected to. I have worked in the past on something similar (much smaller scale) with Scapy and Python, so I know it's possible. Unfortunately, and fortunately, ICMP responses are disabled, rendering tracert's that point only to the building's main switch, followed by an immediate hop to the device (missing hops).
Doing testing with netsh, I can find the BSSID that any given computer on the domain is connected to when I am physically using the machine. In essence, the goal then here is to find a way to get the machine to report to me what the BSSID is of its own network connection, which would allow me to reference our network map and work on that.
I am using Python for the bulk of this program, as I've worked with Scapy before on similar tasks. I have code all prepared for resolving IP from hostname, mac from IP, etc etc. However, these functions are all working so until I resolve this there is no point in including that code in this post. I'm open to any alternative ideas, though I have tried scanning ports and running TCP traceroutes to no avail. Note: this is a Windows environment so Linux is out of the question, sadly. Show me what you've got!

get IP adresses of my local network

I am working on a GUI program to command power supplies by Ethernet.
I have the DHCP of my computer activated, therefore I guess that the IP adresses of my power supplies are fixed by my computer.
I would like to know the IP addresses of my power supplies, in order to communicate with them through the TCP/IP protocol, using Python.
For the moment, I use a program called LXI discovery tools, and while I run it, the Window command arp -a command gives me the IP adresses of my power supplies.
The problem is that I need to run this LXI program. Is it obligatory?
Owing to the DCHP, my computer is the one which sets the IP addresses, therefore isn't there a way to get those addresses more easily?
Moreover, is the Python socket library able to help me?
Finally I solved my problem, using statique IP addresses. Therefore I know them and I don't need anymore to "scan" my network.

Setting IP and Subnet in python

I've been doing the programming for a start up company I know to get some experience. I've been told I'll need to relay data from my original piece of software running on one computer to 8 others using ethernet. Bear in mind I haven't really done much network stuff before.
I see that I'll need the python socket module so I've learned a bit of that. I also get that I'll need a network switch hardware-wise.
What I'm unsure about is how I set up the network in the first place. I get that I can do this via Device Manager but setting all computers to the same subnet and different IP addresses. However, the idea is that people will bring their laptops to be connected, so I don't want to have to mess around with each laptop to connect it to the network. So is there a way of doing this directly in Python so that I can just write it in the program that I'll have running on each laptop?
Thanks!
You need a DHCP server and people's NIC's to retrieve their network configuration automatically.
Windows:
netsh interface ip set address "Local Area Connection" dhcp
Debian (/etc/network/interfaces):
auto eth0
iface eth0 inet dhcp
Red Hat (/etc/sysconfig/network-scripts/ifcfg-eth0):
DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes
I suppose you could use Python or whatever language you're convenient in to fetch the relevant interface's name, as they're not guaranteed to be named "eth0" or "Local Area Connection", e.g. subprocess.Popen("cat /proc/net/dev/").

Pyserial microcontroller to host communication

I am using a Beaglebone Black (BBB) with Python and pyserial to communicate with an OBD-II reader. I am essentially trying to build a customizable digital gauge panel. Ideally I would like to use Flash for the GUI. Sadly Linux support for Flash is pretty weak. I would like to be able to send data from the BBB using Python to a OSX host computer.
I am currently using terminal to shell into the BBB to run code. I would need to be able to send data from the BBB via a USB/serial interface to the OSX computer running Flash. What would be the best method of accomplishing this?
I have not used beaglebone. I have worked with arduino's serial I/O. But this post says you have multiple serial I/O ports on BBB. Find appropriate connectors/convertors for serial to USB.
Then use the pyserial python module.
On OSX, you will find your device when connected on a path like /dev/ttyo1 where dev is my system name and ttyo1 or something similar will be your device.
import serial as s
device = "/dev/tty01"
bbb = s.Serial(device, 4800) #the second param is baudrate
while(True):
bbb.readline()
# do what you want with the output.
bbb.write('input')
This will read till the end of line character and give you a string. and then write "input" to the serial io on bbb. You will need a similar program running on BBB to read this input and do what you want to do with it.
So there will be two python programs. One on the OSX and the other on the BBB
That way you can give commands from OSX.py, let your BBB.py process and send a response. Which the OSX.py will read and do what is to be done.
You will have to design the input/output cycle properly.
Also if flash is not really necessary you can check out pyside.

Categories

Resources