How to use raw_gadget to simulate wifi card in order to test the r8192u_usb.ko driver of linux kernel without real hardware - linux-device-driver

I want to test drivers/staging/rtl8192u/r8192u_usb.ko of linux kernel without real hardware. I try to use raw_gadget to simulate the Realtek RTL8192 USB WiFi card, but I could not reach the rtl8192_usb_probe() function. Do you know what configuration should I do in order to simulate the Realtek RTL8192 USB WiFi card?

Related

Writing an I2C kernel driver for a particular architecture

If we have a particular ARM-based SOC which has a physical I2C controller included on it, and the intention is to run Embedded Linux on this SOC.
Now we have a separate off-board I2C slave chip connected to this I2C bus from the SOC. For argument's sake, let's say that it's an RTC chip.
The kernel driver for this external RTC chip would more than likely be developed by the RTC chip vendor. Would this vendor need to know about the exact register addresses on the SOC chip in order to write to and read from, or is there other architecture specific code for the chip that the kernel driver can link to?

How to send data from STM32 USB port to Raspberry PI USB port?

I want to send data through USB between STM32 and Raspberry Pi. I don't want to use USB to Serial convertor, but instead have a actual USB Connection (maybe CDC class). I have to send data at high rate (Full speed). Please guide on how to achieve this?
A USB-serial connector is simply a microcontroller implementing a USB CDC/ACM virtual COM port and bridging to a UART which you would connect to a microcontroller's UART interface.
In your case you can simply implement the CDC/ACM directly on the STM32 using either of its USB device controller peripherals (USB support varies depending on the specific device https://www.st.com/resource/en/application_note/dm00296349-usb-hardware-and-pcb-guidelines-using-stm32-mcus-stmicroelectronics.pdf).
How you actually implement that will depend on what specific part, and what library or framework ecosystem you are using (e.g. SPL, CubeMX, Mbed). There are reference implementations, examples, drivers and libraries for all of these.
Your milage may vary, but I have measured ST's own USB library and example CDC/ACM virtual COM for STM32F1xx on a 72MHz MCU achieving 700kbits/s. Note that the performance is independent of the baud rate you might set on the host when you open the he VCP. Setting the baud rate simply sends a control packet to the device that can be used to set the baud rate of a UART in bridging applications. In your case such control packets can be ignored. There are similar packets for modem control signals such as DTR, RTS, CTS and RI, which you might choose to us for flow control or other signalling.

Linux I2C driver porting issue

I am porting an I2C driver to Linux-4. This device provides multiple I2C addresses for different function simultaneously.
For example:
address 0xAA is for access of SPI flash.
address 0xA0 is for access of EEPROM.
address 0x60 is for normal access (control purpose).
Is it possible to support access of different I2C address in single-one I2C device driver?
Any help appreciated,
Thanks
I think it is possible. Using i2c_transfer() you are giving particular address in i2c_msg structure of the device you want to communicate with. So your driver will be able to communicate with all of the functions of your i2c device.
Depends on what type of I2C driver you are talking about, bus(adapter) or chip(client) driver?
i2c-dev.c is a kind of bus driver with character device interface which exports kernel low level I2C API to userspace.
For each registered I2C adapter Kernel will add i2c-N device node in /devuserspace interface.
But you can't read/write EEPROM chip attached to /dev/i2c-N like simple character device or file. You need to write some utility program regarding chip protocol.
But in Linux there is are special EEPROM chip drivers like eeprom.c or at24.c for registering I2C EEPROM devices with addresses of 0x50..0x57(if I'm not wrong) to Kernel and creating files in /sys userspace interface.
You can access them as a file in:/sys/bus/i2c/devices/0-005x/eeprom
Thanks for Dražen Grašovec and user2699113 's help.
I am porting a I2C device driver (chip, client) to Linux-4.9.
This chip accepts different I2C device address for different purpose.
My goal is to create only one I2C device on Linux device tree file (.dts)
I resolved my issue by using i2c_new_dummy().
In driver probe function,
I made two i2c_new_dummy() to create two additional i2c clients.
One(client#1) is for accessing of I2C address 0xAA, another(client#2) is for I2C address 0xA0.
So I can use client#1 to communicate with its SPI flash and use client#2 to access it EEPROM.

Raspberry Pi VoIP with usb phone

Are there any USB devices that can be connected with a Linux Softphone?
These USB phones are enumerating as USB composite device: sound device and some control device, usually custom HID.
Audio part should work with virtually any softphone (e.g. command line baresip or pjsua). One I have (EX-03) has not the best sound quality as it supports only 8kHz sampling, but in general they should be fine for telephone calls.
Control part (receiving events from keybord, using ring speaker or display if present) may be tricky to handle as it may be impossible to find any documentation. If you are lucky you may find other software (e.g. skype control software included on CD) that works with this particular USB phone and then use USB sniffer to analyze packets / protocol.

SD card emulator

I have one project to do.
I need to transfer photos from camera to PC, i need to use SDcard interface it is SPI i hope ).
Because usb transfer is not in option, so i think that i connect some microcontroller or raspberry pi instead of sdcard and emulate sd card and from microcontroller i somehow send it (via usb or ethernet)to pc. this whole operation (wrom camera to pc) must be realy quick (1-2s) and photos are 2-4Mbyte. Do you have any tips how to do that or what microconroller chose?
scheme:
SPI as SD emulator USB/Ethernet
|camera|--------------->|microcontroller| ---------------> |PC|
thanks for advices and ideas.