I'm using Mac OS X. I bought this Huawei E3531 because I need to use it as a GSM modem trough AT commands to send SMS. Connection is fine and all works great, but I need to switch the mode so that it can works as a serial modem and I can connect to it trought the screen command
screen /dev/tty...
According to this post Trying to use the AT command with an Huawei E3531 I'm trying to switch the mode. Problem is that it doesn't work.
Here I show you my moves.
First of all I need to find the vendor Id and the Product Id of this product so I launch the following command:
lsusb
I find this line very interessant:
Bus 038 Device 003: ID 12d1:14dc Huawei Technologies Co., Ltd. HUAWEI
Mobile
So, the vendor Id is 12d1 and the product id is 14dc.
Now I want to switch the mode by this command:
sudo usb_modeswitch -R -v 12d1 -p 14dc -W -M '55534243123456780000000000000011062000000100000000000000000000'
As result it gives me the following log:
MacBook-Pro-di-mac:usb-modeswitch-2.5.2 mac$ sudo ./usb_modeswitch -R -v 12d1 -p 14dc -W -M '55534243123456780000000000000011062000000100000000000000000000'
Password:
Take all parameters from the command line
* usb_modeswitch: handle USB devices with multiple modes
* Version 2.5.2 (C) Josua Dietze 2017
* Based on libusb1/libusbx
! PLEASE REPORT NEW CONFIGURATIONS !
DefaultVendor= 0x12d1
DefaultProduct= 0x14dc
MessageContent="55534243123456780000000000000011062000000100000000000000000000"
Look for default devices ...
found USB ID 12d1:14dc
vendor ID matched
product ID matched
found USB ID 05ac:8213
found USB ID 05ac:0237
found USB ID 0a5c:4500
found USB ID 05ac:8403
found USB ID 05ac:8242
found USB ID 05ac:8507
Found devices in default mode (1)
Access device 003 on bus 038
Get the current device configuration ...
Current configuration number is 1
Use interface number 0
with class 2
Error: can't use storage command in MessageContent with interface 0; interface class is 2, expected 8. Abort
How can I resolve this error? I searched also in other forum, websites and so on, but didn't find a satisfied solution.
Thank you
Related
I am using Firebase emulators to test my Android app. I'm trying to set up a testing environment where an Android emulator(AVD manager device) AND an android real device have access to my Firebase emulator real time database found on http://localhost:4000.
I can make both(real and virtual) devices, individually, have access to the Firebase emulator database, but NOT both at the same time.
I have my real device connected via USB port and allowed USB debugging and my Android emulator running at the same time. Then, on the Android Studio platform-tools folder I opened up a command window and input the following:
adb reverse tcp:4000 tcp:4000
This gives me an error: adb.exe: error: more than one device/emulator
Inside my firebase.json file found inside my Firebase emulator project I have the following set-up for connections to my database:
"database": {
"host": "localhost",
"port": 9000
},
How can I make both (REAL and VIRTUAL) devices or two (Virtual) devices connect to Firebase emulator Real Time data base?
You should specify the device serialno
adb -s serialno reverse tcp:4000 tcp:4000
or, -d and -e if you have one of each (emulator, device).
Additionally, to select the device interactively you can use this gist: https://gist.github.com/dtmilano/4537110
Thank you Diego Torres Milano for pointing me in the right direction.
using the command: adb -s serialno reverse tcp:4000 tcp:4000 will work!
HOWEVER you must FIRST run the command
adb devices
Once you run this command, you get all the serial no's of all the connected devices you have to ADB. Then, just run:
adb -s serialno reverse tcp:4000 tcp:4000 using your desired device/emulator. It works for either real device or emulator!
I need to use Peak System PCAN USB dongle in my Qt6 application.
At first I checked it works from command line.
In my Ubuntu 20.04 I have the kernel drivers installed:
$ grep PEAK_ /boot/config-`uname -r`
CONFIG_CAN_PEAK_PCIEFD=m
CONFIG_CAN_PEAK_PCI=m
CONFIG_CAN_PEAK_PCIEC=y
CONFIG_CAN_PEAK_PCMCIA=m
CONFIG_CAN_PEAK_USB=m
and loaded:
$ lsmod | grep ^peak
peak_usb 49152 0
I also tried to exchange data with can-tools and it worked out of the box.
Here the relevant output of the ip command:
$ ip addr
6: can0: <NOARP,ECHO> mtu 16 qdisc pfifo_fast state DOWN group default qlen 10
link/can
The problem arises when I try to connect from the Qt application:
std::unique_ptr<QCanBusDevice> _device;
QString errorString;
_device.reset(QCanBus::instance()->createDevice("peakcan", "can0", &errorString));
I get:
qt.canbus.plugins.peakcan: Cannot load library pcanbasic: (pcanbasic: cannot open shared object file: No such file or directory)
So I downloaded the PCAN Basic package.
In the readme there are the requirements:
System Requirements
-------------------
- PCAN Linux Driver: 8.0.17 and above
(Driver for Linux can be download at www.peak-system.com/linux)
So I compiled and installed the drivers. Now the peakcan plugin is found:
qt.canbus.plugins.peakcan: Using PCAN-API version: 4.5.2.15
but now:
no device is discovered by Qt
ip addr shows no can devices
lsmod | grep ^peak shows no drivers loaded
Question #1: am I missing anything in order to get it works?
By the way, in the Linux driver page they also state:
The CAN interfaces are then accessed via the common SocketCAN framework as network devices
Hence I tried to find any available device using socketcan:
QString errorString;
const QList<QCanBusDeviceInfo> devices = QCanBus::instance()->availableDevices(QStringLiteral("socketcan"), &errorString);
if (!errorString.isEmpty()) qDebug() << errorString;
foreach (QCanBusDeviceInfo info, devices)
{
qDebug() << info.name();
}
but it finds no devices.
If I try to connect to it:
std::unique_ptr<QCanBusDevice> _device;
QString errorString;
_device.reset(QCanBus::instance()->createDevice("socketcan", "can0", &errorString));
I get:
RTNETLINK answers: Operation not permitted
I guess because I'm running the application with user privileges.
I get the same error if I try to bring the interface up without sudo:
$ ip link set can0 up
RTNETLINK answers: Operation not permitted
Question #2: Is there any group I need to join to in order to let Qt6 to bring up the network device without root privileges?
I'm writing a kernel from scratch in Rust for 64-bit ARM devices. For testing purpose, I use Qemu virt machine.
Currently, I'm able to write characters from guest to host console through UART. Now I would like to do the opposite, i.e. send characters from host console to guest UART port. Is there a way to do this? Should I add some arguments to Qemu?
I run Qemu virt machine with the following arguments:
qemu-system-aarch64 -M virt -cpu cortex-a57 -nographic -serial pty -S -kernel target/aarch64-unknown-none/debug/cortex-a57
It gives me a new pty that I can attach with screen /dev/pts/mypty. Then I run the program tapping c in Qemu console.
I would like to use the same pty (or a new one?) to write data to the guest.
QEMU always redirects both input and output for a guest UART to the same place; this is true of all of '-serial stdio', '-nographic' (which does an implicit '-serial mon:stdio') and '-serial pty'. So you don't need to do anything extra. If UART input is not working then the problem seems likely to be a bug in your guest code.
Just read the same TTY as Qemu redirects all input to the same place.
I have set up a ITEAD sim900 GSM module to interface with raspberry pi. I believe I have established a gprs connection to AT&T though wvdial as I get these results.
--> WvDial: Internet dialer version 1.61
--> Initializing modem.
--> Sending: AT+CGDCONT=1,"IP","Broadband"
AT+CGDCONT=1,"IP","Broadband"
OK
--> Modem initialized.
--> Sending: ATDT*99#
--> Waiting for carrier.
ATDT*99#
CONNECT
--> Carrier detected. Starting PPP immediately.
--> Starting pppd at Thu Aug 14 05:49:20 2014
--> Pid of pppd: 2794
I have been looking all over the internet for some answers to a few questions that I have, but I can't seem to find any. Any help with the following questions will be greatly appreciated! Thanks!
I have three questions, and some may be stupid as I am VERY new to this field.
Am I actually connected to AT&T's GPRS network?
How can I make this module (serial port /dev/ttyAMA0) my default internet connection? What I mean is I want all internet traffic routed through this modem(web surfing, email etc.). I am connected to the Raspberry via ssh so I have to have either ethernet or wifi active to access the computer--I am currently using ethernet. After I connect through wvdial in the way shown above, and disable all other internet sources I have no access. It seems to still be looking to the active ethernet port for data(I could be wrong).
For my project I need to have the sim900 modem as the internet access point, but I also need to be able to connect to a LAN via wifi that has no internet access. Is this possible?
Finally i got the ( raspberrypi + ppp + gprs/gsm-modem ) working.
Some notes before start:
Make sure the power supply you used for raspberrypi is exact 5V and it can provide at-least 2A current without voltage drop-out.The SIM900 power-source must be 3.3V 2A
Set the SIM900 baud rate to 115200 via: AT+IPR=115200
Check the modem serial peripheral via: $ screen /dev/ttyAMA0 115200 type AT<enter> it will echo: OK. Hit ctrl+a k y to exit.
/etc/ppp/options-mobile
ttyAMA0
115200
lock
crtscts
modem
passive
novj
defaultroute
replacedefaultroute
noipdefault
usepeerdns
noauth
hide-password
persist
holdoff 10
maxfail 0
debug
Create the /etc/ppp/peers directory:
$ mkdir /etc/ppp/peers
$ cd /etc/ppp/peers
/etc/ppp/peers/mobile-auth
file /etc/ppp/options-mobile
user "your_usr"
password "your_pass"
connect "/usr/sbin/chat -v -t15 -f /etc/ppp/chatscripts/mobile-modem.chat"
/etc/ppp/peers/mobile-noauth
file /etc/ppp/options-mobile
connect "/usr/sbin/chat -v -t15 -f /etc/ppp/chatscripts/mobile-modem.chat"
Create the /etc/ppp/chatscripts directory:
$ mkdir /etc/ppp/chatscripts
/etc/ppp/chatscripts/mobile-modem.chat
ABORT 'BUSY'
ABORT 'NO CARRIER'
ABORT 'VOICE'
ABORT 'NO DIALTONE'
ABORT 'NO DIAL TONE'
ABORT 'NO ANSWER'
ABORT 'DELAYED'
REPORT CONNECT
TIMEOUT 6
'' 'ATQ0'
'OK-AT-OK' 'ATZ'
TIMEOUT 3
'OK' #/etc/ppp/chatscripts/pin
'OK\d-AT-OK' 'ATI'
'OK' 'ATZ'
'OK' 'ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0'
'OK' #/etc/ppp/chatscripts/mode
'OK-AT-OK' #/etc/ppp/chatscripts/apn
'OK' 'ATDT*99***1#'
TIMEOUT 30
CONNECT ''
/etc/ppp/chatscripts/my-operator-apn
AT+CGDCONT=1,"IP","<apn-name>"
/etc/ppp/chatscripts/pin.CODE
AT+CPIN=1234
/etc/ppp/chatscripts/pin.NONE
AT
/etc/ppp/chatscripts/mode.3G-only
AT\^SYSCFG=14,2,3fffffff,0,1
/etc/ppp/chatscripts/mode.3G-pref
AT\^SYSCFG=2,2,3fffffff,0,1
/etc/ppp/chatscripts/mode.GPRS-only
AT\^SYSCFG=13,1,3fffffff,0,0
/etc/ppp/chatscripts/mode.GPRS-pref
AT\^SYSCFG=2,1,3fffffff,0,0
The SYSCFG line in the mode.* files is device-dependent, and likely Huawei-specific, So You may use the mode.NONE file if your modem is
SIM900.
*
/etc/ppp/chatscripts/mode.NONE
AT
Make some symbolic links:
$ ln -s /etc/ppp/chatscripts/my-operator-apn /etc/ppp/chatscripts/apn
$ ln -s /etc/ppp/chatscripts/mode.NONE /etc/ppp/chatscripts/mode
$ ln -s /etc/ppp/chatscripts/pin.NONE /etc/ppp/chatscripts/pin
If you have to enter credentials use mobile-auth
$ mv provider provider.example
$ ln -s /etc/ppp/peers/mobile-noauth /etc/ppp/peers/provider
Check syslog in another console:
$ tail -f /var/log/syslog | grep -Ei 'pppd|chat'
Finally issue the pon command to see the result:
$ pon
The base instruction : https://wiki.archlinux.org/index.php/3G_and_GPRS_modems_with_pppd
(Wow it took me a while to post this question because of the formatting problem coming from special characters..)
I'm trying to bring up virtual terminal on our embedded system's LCD usnig USB keyboard which is also connected to the system. I have UART connection to my PC so I've been using UART for console till now but I want to switch to framebuffer console on LCD during the boot at some point..
The USB host controller seems to work fine because I've seen USB memory is attached, read and written ok. And when I connect a keyboard and print the events at keyboard_event function, it prints events that seem normal and corresponding to my action(type of key, press or release..)
I have a feeling that it's a configuration problem. In init/main.c, there is
run_init_process(ramdisk_execute_command);
(In my case, ramdisk_execute_command = "/sbin/init")
And this immediately calls
kernel_execve(init_filename, argv_init, envp_init);
// above, init_filename and argv_init are "/sbin/init" same.
I expect busybox to run after this.. (ramdisk had been installed before by a bootloader-like part) but I cannot see any prints on the LCD after this point. But I can see printks on the LCD until just before calling kernel_execve above. I'm using linux 3.3.
I understand I have to open a frame buffer console on LCD and connect it to a tty but I don't know how. Below are printed the current releavant settings.
(In serial UART connection case, linux boots ok up to the final busybox shell prompt printing things in busybox initialization after kernel_execve call. and #cat /proc/fb0 returns 0 for your info. Only LCD/framebuffer console mode stops after kernel_execve.)
#### arch/sparc/boot/ourprocessor/prom_stage.c : #####
// "console=ttyS,mmio,0xff003000,115200n8 " <== serial port case
"console=tty " <= frame buffer console case (below line too)
"fbcon=font:SUN8x16,map:0000 " <= Is this boot argment correct?..
#### sbin/init: #####
#!/bin/busybox sh
export LD_LIBRARY_PATH=/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/mnt/nand/lib
exec /bin/busybox init
### rcS #####
mknod /dev/tty0 c 4 0 <== Do I need to explicitly make tty0 and tty1 like this?
mknod /dev/tty1 c 4 1
mknod /dev/tty2 c 4 2
mknod /dev/tty3 c 4 3
mknod /dev/tty4 c 4 4
### .config #####
CONFIG_FRAMEBUFFER_CONSOLE=y <= LCD/framebuffer console case. Otherwise none.
CONFIG_FONT_SUN8x16=y
CONFIG_LOGO=y
By the way, I'm not using /etc/inittab.(so use default init). The busybox init/init.c code says if there isn't the inittab file and console is not the serial port, it runs
tty2::askfirst:/bin/sh
tty3::askfirst:/bin/sh
tty4::askfirst:/bin/sh
(starting shell on tty 2, 3 and 4) then How do make tty2's shell appear on the LCD/framebuffer/framebuffer console? It's confusing and books are not so kind..
Any hint would be deeply appreciated.
This question was solved months ago and I forgot to answer to this question myself.
Adding CONFIG_FRAMEBUFFEr and CONFIG_FBCONSOLE and setting console=ttyS,.. was all that is necessary. In my case, I had another bug in DMA that was causing the frambe buffer console's text not appear on the LCD. So I can use 3 virtual consoles on the LCD (switch using Alt-F2, Alt-F3, .. ) by default. Long storyg short, console is a console(on serial port), and we have 3 (by default busybox setting) virtual console on the LCD.