In iOS , I can get camera buffer image from the SDK, but in the Linux world, if I plug a camera to the machine, how can I get the camera buffer in Linux system? Thanks.
Each device in Linux word is linked to a file into the /dev directory. Precisely, the video devices usually are located into the /dev/v4l folder. In the folder you should find symbolic links that point to the /dev/video0 (the real file associated with the physical device file).
If you need to access to the buffer of the cam, you just need to open the file and start reading.
Related
I am looking for a command line tool for flashing my NUCLEO card in ubuntu. I want this tools for flash my NUCLEO remotely with node.js. I already try st-flash and stm32flash but these tools don't work properly. My programs are generated by mbed online tool.
Do you have any suggestions ?
Thanks for your answers
You can update Nucleo boards simply by copying the mbed image to the mass storage device presented when you connect to the composite USB interface.
The image file is automatically written to the microcontroller flash by the integrated STLink device when the file is placed on the USB drive. This is a "write-only" device; the written file cannot be read back - if you interrogate the drive it always appears empty.
In Ubuntu you may have to explicitly mount the device. If it mounts automatically it will appear under /mnt (I guess).
Since it is a standard USB mass storage interface, you should not need any Nucleo or ST specific driver or software. It is a "drag & drop" programming interface.
If your board does not appear as a mass storage device, you may need to update the integrated STLink firmware as described at https://os.mbed.com/teams/ST-Americas-mbed-Team/wiki/Preparing-the-STM32-Nucleo-Board
I have a special bespoke device with a USB interface. When plugging in the device to my laptop - Ubuntu 12.04 it mounts as a read only USB drive - with a file on it. This file is created by the device and writes to the file when the device scans stuff.
I however, want to be able to write to the drive so the device 'thinks' it has already scanned x amount of entries.
Basically I want to replace the file 'File1.txt' my version of 'File1.txt' however I cannot because the drive is mounting as Read only.
I have tried the following commands:
andy#andy-ThinkPad-W530:/media/iRead$ touch giveme.txt
touch: cannot touch `giveme.txt': Read-only file system
andy#andy-ThinkPad-W530:/media/iRead$ sudo mount -o remount,rw '/media/iRead'
[sudo] password for andy:
mount: cannot remount block device /dev/sdb read-write, is write-protected
andy#andy-ThinkPad-W530:/media/iRead$
Can anybody suggest anything I can try to mount this as writable drive?
I have a very strong feeling that the chip which is storing this data is the following:
ARM STM32F103 RBT6 22oUP _ 93 MLT22950
Hope this helps somebody to help me!
If processing write commands coming from USB wasn't part of the requirements, it's very unlikely that the device processes write commands.
A read-only USB mass storage device is not a read-write mass storage device with write-protection slapped on top. It's a USB device that doesn't have logic for understanding write requests at all.
After the device is finished and delivered is a little late for deciding
I want to be able to write to the drive so the device 'thinks' it has already scanned x amount of entries.
Of course the flash memory used inside the device is written during its operation. But the way data is stored inside might not look anything like its USB presentation, and the conversion is most likely one-way only.
Since the developer probably did not implement mass storage support from scratch, and the library they used probably has write support, they may be able to easily supply you with firmware modified to be writable and do something with the written data. But without changing the firmware, you get nowhere.
I have a problem. My system is an embedded Linux plaform. I am connecting to my board using serial port and I can access U-Boot.
I need to extract the complete firmware residing in flash through the console or through Ethernet. It looks like downloading is easy using TFTP or serial (Kermit, etc), but uploading it to the host PC for backup isn't obvious.
Does anyone know how this can be done?
Assuming that you are using NAND flash and U-Boot 2013.07 or similar:
Use the nand info command to see the NAND device names, sizes and erase block sizes for each NAND device that U-Boot detects
Use the nand read command to read from the NAND into RAM. How much NAND to read into RAM depends on the RAM size
If you have an SD (MMC) drive you can write from RAM to SD using the mmc write command
If you have a USB device you can use start usb to scan the USB for a mass storage or "ethernet" (i.e. OTG) device
If start usb detects a mass storage device, you can write from RAM to the mass storage device using the usb write command
There is no way to transfer from RAM to a USB or Ethernet network connection
Use the md command to hex dump arbitrary size block of memory to the serial line, then use some program to translate the ASCII hex back into binary
If you're willing to rebuild uboot and reflash your board, you can enable the tftpput command with the CONFIG_CMD_TFTPPUT option. (Assuming a recent version of uboot.)
Assuming not, within the embedded Linux, you can access your flash through /dev/mtd* (cat /proc/mtd to see the partitions). You can use dd to copy a partition to a ramdisk file, then use cat to combine the files into a single image, and the use ftpput to send it to your host. (This assumes that your embedded busybox has been built with these commands.)
Where in the Linux kernel source code can I find the function(s) that deal with sending data to a USB flash drive? By "data", I mean the actual file contents. For example, when I drag and drop "Report.docx" to the USB thumb drive, I need to be able to intercept this data to the point where I could modify the contents of the file before it is written to the USB thumb drive.
I understand that the USB storage module (drivers/usb/storage) is where USB mass storage devices like thumb drives are handled, but I failed to find the right place to look. I looked around transfer.c but my debugging attempts just show the functions get called whether or not I'm transferring any files. Also, from my understanding, everything is done with URBs and I'm not clear on how to deal with those. Am I looking in the right place?
For the purposes of my project, I need to modify the driver (not using any third-party libraries or user-space code). I am working with Linux 3.12.0.
Not an expert in usb subsystem, but I would start by looking at
drivers/usb/storage/transport.c::usb_stor_bulk_transfer_buf()
I have a popular drawing tablet that I connect to my PC with USB. Once connected, the tablet detects hand movements and manipulates the pointer accordingly. Somewhere, the tablet is transmitting this data to my computer.
My goal is to intercept these transmissions and manipulate the mouse after I process the data. The buzzwords I have found are: device drivers and HID, but I haven't been able to piece together much more than that.
Assuming this is possible, I have a few questions:
How is this done if the data format is known?
How is this done if the data format is unknown/proprietary?
My computer is running Ubuntu (but answers related to any form of a Linux OS are greatly appreciated!).
Note: This question is similar but intended for Windows.
Actually you missed a buzzword "USB sniffing". ;-)
Here are a few tutorials on USB sniffing on Linux, to get you started.
Official Wireshark wiki for USB monitoring
biot.com/blog/usb-sniffing-on-linux (InternetArchive)
tjworld.net/wiki/Linux/Ubuntu/USBmonitoring
Essentially you use the usbmon Linux kernel module to capture the USB-packets and Wireshark as a front-end to display and analyse the captured USB stream.
To add another useful resource: Kernel manual for usbmon
You can use the following commands on Debian Linux to view debug log for usbmon in text format using usbmon Kernel's built in usb monitoring:
$sudo -i to use root
#modprobe usbmon
#ls /sys/kernel/debug/usb/usbmon to view bus sockets
#cat /sys/kernel/debug/usb/devices to view devices at each bus socket
#cat /sys/kernel/debug/usb/usbmon/<bus socket> to view or you can route stdout to a file using >