Automatic Activation, Hotplug and UDEV, Configuration
Post Reply
dmitriyku
Posts: 4
Joined: 21 May 2010, 07:31

AnyData ADU-500A on OpenBSD

Post by dmitriyku » 21 May 2010, 07:43

Hi.
I don't speek english. Sory.

How to connect modem AnyData ADU-500A on OpenBSD?


# dmesg
OpenBSD 4.6 (GENERIC.MP) #5: Sun Apr 25 20:58:23 YEKST 2010
root@dima.home.ru:/usr/src/sys/arch/i386/compile/GENERIC.MP
cpu0: Intel(R) Core(TM)2 Quad CPU Q8400 @ 2.66GHz ("GenuineIntel" 686-class) 2.67 GHz
cpu0: FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,SBF,SSE3,MWAIT,DS-CPL,VMX,EST,TM2,CX16,xTPR
real mem = 2146529280 (2047MB)
avail mem = 2066780160 (1971MB)
mainbus0 at root
bios0 at mainbus0: AT/286+ BIOS, date 09/03/09, BIOS32 rev. 0 @ 0xf0010, SMBIOS rev. 2.5 @ 0xf0710 (63 entries)
bios0: vendor American Megatrends Inc. version "0402" date 09/03/2009
bios0: ASUSTeK Computer INC. P5P43TD
acpi0 at bios0: rev 0
acpi0: tables DSDT FACP APIC MCFG OEMB HPET OSFR SSDT
acpi0: wakeup devices P0P2(S4) P0P3(S4) P0P1(S4) UAR1(S4) PS2K(S4) PS2M(S4) EUSB(S4) USBE(S4) P0P5(S4) P0P6(S4) P0P7(S4) P0P8(S4) P0P9(S4) GBEC(S4) USB0(S4) USB1(S4) USB2(S4) USB3(S4) USB4(S4) USB5(S4) USB6(S4) P0P4(S4)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: apic clock running at 336MHz
cpu1 at mainbus0: apid 1 (application processor)
cpu1: Intel(R) Core(TM)2 Quad CPU Q8400 @ 2.66GHz ("GenuineIntel" 686-class) 2.70 GHz
cpu1: FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,SBF,SSE3,MWAIT,DS-CPL,VMX,EST,TM2,CX16,xTPR
cpu2 at mainbus0: apid 2 (application processor)
cpu2: Intel(R) Core(TM)2 Quad CPU Q8400 @ 2.66GHz ("GenuineIntel" 686-class) 2.70 GHz
cpu2: FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,SBF,SSE3,MWAIT,DS-CPL,VMX,EST,TM2,CX16,xTPR
cpu3 at mainbus0: apid 3 (application processor)
cpu3: Intel(R) Core(TM)2 Quad CPU Q8400 @ 2.66GHz ("GenuineIntel" 686-class) 2.70 GHz
cpu3: FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,SBF,SSE3,MWAIT,DS-CPL,VMX,EST,TM2,CX16,xTPR
ioapic0 at mainbus0: apid 4 pa 0xfec00000, version 20, 24 pins
acpihpet0 at acpi0: 14318179 Hz
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus 1 (P0P2)
acpiprt2 at acpi0: bus -1 (P0P3)
acpiprt3 at acpi0: bus 5 (P0P1)
acpiprt4 at acpi0: bus -1 (P0P6)
acpiprt5 at acpi0: bus -1 (P0P7)
acpiprt6 at acpi0: bus 3 (P0P8)
acpiprt7 at acpi0: bus 2 (P0P9)
acpicpu0 at acpi0: PSS
acpicpu1 at acpi0: PSS
acpicpu2 at acpi0: PSS
acpicpu3 at acpi0: PSS
acpibtn0 at acpi0: PWRB
bios0: ROM list: 0xc0000/0xe200 0xce800/0x2000!
cpu0: Enhanced SpeedStep 2694 MHz: speeds: 2670, 2336, 2003 MHz
pci0 at mainbus0 bus 0: configuration mode 1 (bios)
pchb0 at pci0 dev 0 function 0 "Intel G45 Host" rev 0x03
ppb0 at pci0 dev 1 function 0 "Intel G45 PCIE" rev 0x03: apic 4 int 16 (irq 10)
pci1 at ppb0 bus 1
vga1 at pci1 dev 0 function 0 vendor "NVIDIA", unknown product 0x06e4 rev 0xa1
wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
uhci0 at pci0 dev 26 function 0 "Intel 82801JI USB" rev 0x00: apic 4 int 16 (irq 10)
uhci1 at pci0 dev 26 function 1 "Intel 82801JI USB" rev 0x00: apic 4 int 21 (irq 14)
uhci2 at pci0 dev 26 function 2 "Intel 82801JI USB" rev 0x00: apic 4 int 18 (irq 15)
ehci0 at pci0 dev 26 function 7 "Intel 82801JI USB" rev 0x00: apic 4 int 18 (irq 15)
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 "Intel EHCI root hub" rev 2.00/1.00 addr 1
azalia0 at pci0 dev 27 function 0 "Intel 82801JI HD Audio" rev 0x00: apic 4 int 22 (irq 3)
azalia0: codecs: Realtek/0x0887
audio0 at azalia0
ppb1 at pci0 dev 28 function 0 "Intel 82801JI PCIE" rev 0x00: apic 4 int 17 (irq 11)
pci2 at ppb1 bus 4
ppb2 at pci0 dev 28 function 4 "Intel 82801JI PCIE" rev 0x00: apic 4 int 17 (irq 11)
pci3 at ppb2 bus 3
jmb0 at pci3 dev 0 function 0 "JMicron JMB368 IDE" rev 0x00
pciide0 at jmb0: DMA, channel 0 wired to native-PCI, channel 1 wired to native-PCI
pciide0: using apic 4 int 16 (irq 10) for native-PCI interrupt
pciide0: channel 0 disabled (no drives)
pciide0: channel 1 disabled (no drives)
ppb3 at pci0 dev 28 function 5 "Intel 82801JI PCIE" rev 0x00: apic 4 int 16 (irq 10)
pci4 at ppb3 bus 2
ale0 at pci4 dev 0 function 0 "Attansic Technology L1E" rev 0xb0: apic 4 int 17 (irq 11), address 90:e6:ba:57:6b:bb
atphy0 at ale0 phy 0: F1 10/100/1000 PHY, rev. 9
uhci3 at pci0 dev 29 function 0 "Intel 82801JI USB" rev 0x00: apic 4 int 23 (irq 6)
uhci4 at pci0 dev 29 function 1 "Intel 82801JI USB" rev 0x00: apic 4 int 19 (irq 5)
uhci5 at pci0 dev 29 function 2 "Intel 82801JI USB" rev 0x00: apic 4 int 18 (irq 15)
ehci1 at pci0 dev 29 function 7 "Intel 82801JI USB" rev 0x00: apic 4 int 23 (irq 6)
usb1 at ehci1: USB revision 2.0
uhub1 at usb1 "Intel EHCI root hub" rev 2.00/1.00 addr 1
ppb4 at pci0 dev 30 function 0 "Intel 82801BA Hub-to-PCI" rev 0x90
pci5 at ppb4 bus 5
xl0 at pci5 dev 0 function 0 "3Com 3c556B 100Base-TX" rev 0x20: apic 4 int 16 (irq 10), address 00:00:86:4d:4e:dc
acphy0 at xl0 phy 0: AC101 10/100 PHY, rev. 11
pcib0 at pci0 dev 31 function 0 "Intel 82801JIB LPC" rev 0x00
pciide1 at pci0 dev 31 function 2 "Intel 82801JI SATA" rev 0x00: DMA, channel 0 configured to native-PCI, channel 1 configured to native-PCI
pciide1: using apic 4 int 19 (irq 5) for native-PCI interrupt
wd0 at pciide1 channel 0 drive 0: <WDC WD5000AAKS-00A7B2>
wd0: 16-sector PIO, LBA48, 476938MB, 976771055 sectors
wd0(pciide1:0:0): using PIO mode 4, Ultra-DMA mode 5
wd1 at pciide1 channel 1 drive 0: <ST31000520AS>
wd1: 16-sector PIO, LBA48, 953868MB, 1953523055 sectors
wd1(pciide1:1:0): using PIO mode 4, Ultra-DMA mode 5
ichiic0 at pci0 dev 31 function 3 "Intel 82801JI SMBus" rev 0x00: apic 4 int 18 (irq 15)
iic0 at ichiic0
spdmem0 at iic0 addr 0x50: 2GB DDR3 SDRAM PC3-10600
pciide2 at pci0 dev 31 function 5 "Intel 82801JI SATA" rev 0x00: DMA, channel 0 wired to native-PCI, channel 1 wired to native-PCI
pciide2: using apic 4 int 19 (irq 5) for native-PCI interrupt
usb2 at uhci0: USB revision 1.0
uhub2 at usb2 "Intel UHCI root hub" rev 1.00/1.00 addr 1
usb3 at uhci1: USB revision 1.0
uhub3 at usb3 "Intel UHCI root hub" rev 1.00/1.00 addr 1
usb4 at uhci2: USB revision 1.0
uhub4 at usb4 "Intel UHCI root hub" rev 1.00/1.00 addr 1
usb5 at uhci3: USB revision 1.0
uhub5 at usb5 "Intel UHCI root hub" rev 1.00/1.00 addr 1
usb6 at uhci4: USB revision 1.0
uhub6 at usb6 "Intel UHCI root hub" rev 1.00/1.00 addr 1
usb7 at uhci5: USB revision 1.0
uhub7 at usb7 "Intel UHCI root hub" rev 1.00/1.00 addr 1
isa0 at pcib0
isadma0 at isa0
com0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo
pckbc0 at isa0 port 0x60/5
pckbd0 at pckbc0 (kbd slot)
pckbc0: using irq 1 for kbd slot
wskbd0 at pckbd0: console keyboard, using wsdisplay0
pcppi0 at isa0 port 0x61
midi0 at pcppi0: <PC speaker>
spkr0 at pcppi0
lpt0 at isa0 port 0x378/4 irq 7
lm0 at isa0 port 0x290/8: W83627DHG
npx0 at isa0 port 0xf0/16: reported by CPUID; using exception 16
mtrr: Pentium Pro MTRR support
umass0 at uhub0 port 1 configuration 1 interface 0 "HLDS Inc SuperMulti RW" rev 2.00/1.59 addr 2
umass0: using ATAPI over Bulk-Only
scsibus0 at umass0: 2 targets, initiator 0
cd0 at scsibus0 targ 1 lun 0: <HL-DT-ST, DVDRAM GE20NU10, EE05> ATAPI 5/cdrom removable
umass1 at uhub0 port 4 configuration 1 interface 0 "Generic Mass Storage Device" rev 2.00/1.26 addr 3
umass1: using SCSI over Bulk-Only
scsibus1 at umass1: 2 targets, initiator 0
sd0 at scsibus1 targ 1 lun 0: <Generic, USB SD Reader, 1.00> SCSI0 0/direct removable
sd0: drive offline
sd1 at scsibus1 targ 1 lun 1: <Generic, USB CF Reader, 1.01> SCSI0 0/direct removable
sd1: drive offline
sd2 at scsibus1 targ 1 lun 2: <Generic, USB SM Reader, 1.02> SCSI0 0/direct removable
sd2: drive offline
sd3 at scsibus1 targ 1 lun 3: <Generic, USB MS Reader, 1.03> SCSI0 0/direct removable
sd3: drive offline
uhidev0 at uhub7 port 2 configuration 1 interface 0 "Genius Optical Mouse" rev 1.10/1.00 addr 2
uhidev0: iclass 3/1
ums0 at uhidev0: 3 buttons, Z dir
wsmouse0 at ums0 mux 0
softraid0 at root
root on wd0a swap on wd0b dump on wd0b
umsm0 at uhub5 port 2 configuration 1 interface 0 "AnyDATA Corporation USB MMC Storage" rev 1.10/0.00 addr 2



# usbdevs -dv
Controller /dev/usb0:
addr 1: high speed, self powered, config 1, EHCI root hub(0x0000), Intel(0x8086), rev 1.00
uhub0
port 1 addr 2: high speed, self powered, config 1, SuperMulti RW(0x1640), HLDS Inc(0x152e), rev 1.59, iSerialNumber 0010101640000F595
umass0
port 2 powered
port 3 powered
port 4 addr 3: high speed, power 100 mA, config 1, Mass Storage Device(0x6362), Generic(0x058f), rev 1.26, iSerialNumber 058F312D81B
umass1
port 5 powered
port 6 powered
Controller /dev/usb1:
addr 1: high speed, self powered, config 1, EHCI root hub(0x0000), Intel(0x8086), rev 1.00
uhub1
port 1 powered
port 2 powered
port 3 powered
port 4 powered
port 5 powered
port 6 powered
Controller /dev/usb2:
addr 1: full speed, self powered, config 1, UHCI root hub(0x0000), Intel(0x8086), rev 1.00
uhub2
port 1 powered
port 2 powered
Controller /dev/usb3:
addr 1: full speed, self powered, config 1, UHCI root hub(0x0000), Intel(0x8086), rev 1.00
uhub3
port 1 powered
port 2 powered
Controller /dev/usb4:
addr 1: full speed, self powered, config 1, UHCI root hub(0x0000), Intel(0x8086), rev 1.00
uhub4
port 1 powered
port 2 powered
Controller /dev/usb5:
addr 1: full speed, self powered, config 1, UHCI root hub(0x0000), Intel(0x8086), rev 1.00
uhub5
port 1 powered
port 2 addr 2: full speed, power 500 mA, config 1, USB MMC Storage(0x1000), AnyDATA Corporation(0x05c6), rev 0.00, iSerialNumber 000000000002
umsm0



By analogy with usb_modeswitch i try send string "5553424312345678000000000000061B00000002000000000000000000000008" to /dev/usb5.
# ./hex2bin "5553424312345678000000000000061B00000002000000000000000000000008" > /dev/usb5


listing hex2bin.c
#include <stdio.h>
#include <string.h>


int hex2num(char c);
int hex2byte(const char *hex);
int hexstr2bin(const char *hex, char *buffer, int len);



int main(int argc, char **argv)
{
char MessageContent[1024];
char ByteString[1024];
int n=0;

if (argc=0) {
fprintf(stderr, "Error: No string. Aborting.\n\n");
exit(1);
};
n=strlen(argv[1]);
fprintf(stderr, "Debug: n=%d.\n", n);
strlcpy(MessageContent, argv[1], n+1);


if (strlen(MessageContent)) {
if (strlen(MessageContent) % 2 != 0) {
fprintf(stderr, "Error: hex string has uneven length. Aborting.\n\n");
exit(1);
}
if ( hexstr2bin(MessageContent, ByteString, strlen(MessageContent)/2) == -1) {
fprintf(stderr, "Error: MessageContent %s\n is not a hex string. Aborting.\n\n", MessageContent);
exit(1);
}
}

exit(0);
}


int hex2num(char c)
{
if (c >= '0' && c <= '9')
return c - '0';
if (c >= 'a' && c <= 'f')
return c - 'a' + 10;
if (c >= 'A' && c <= 'F')
return c - 'A' + 10;
return -1;
}


int hex2byte(const char *hex)
{
int a, b;
a = hex2num(*hex++);
if (a < 0)
return -1;
b = hex2num(*hex++);
if (b < 0)
return -1;
return (a << 4) | b;
}

int hexstr2bin(const char *hex, char *buffer, int len)
{
int i;
int a;
const char *ipos = hex;
char *opos = buffer;

for (i = 0; i < len; i++) {
a = hex2byte(ipos);
//printf("%02X", a);
if (a < 0)
return -1;
*opos++ = a;
fprintf(stdout, "%c", a);
ipos += 2;
}
return 0;
}


Please Help.
Dmitriy.

Josh
Site Admin
Posts: 6570
Joined: 03 Nov 2007, 00:30

Post by Josh » 21 May 2010, 08:33

I have no experience with OpenBSD.

Theoretically, usb_modeswitch - the binary program - should work in OpenBSB too, you just need "libusb" on the system. Did you try to run usb_modeswitch ?

The automatic switching provided with the source package will probably not work, because it relies on the Linux sysfs tree.


dmitriyku
Posts: 4
Joined: 21 May 2010, 07:31

Post by dmitriyku » 21 May 2010, 12:07

Maked usb_modeswitch.

Run commands
#./usb_modeswitch -R 1 -v 05c6 -p 1000 -V 16d5 -P 6502 -m 0x00000008 -M 5553424328932a86000000000000061b000000020000000000000000000000
#sleep 5
#./usb_modeswitch -v 05c6 -p 1000 -V 16d5 -P 6502 -m 0x00000008 -M 5553424328932a86000000000000061b000000020000000000000000000000


>Looking for target devices ...
> No devices in target mode or class found
>Looking for default devices ...
> No devices in default mode or class found. Nothing to do. Bye.
>
>
>Looking for target devices ...
> No devices in target mode or class found
>Looking for default devices ...
> No devices in default mode or class found. Nothing to do. Bye.


Whether there is a possibility to set a device name manually?

Josh
Site Admin
Posts: 6570
Joined: 03 Nov 2007, 00:30

Post by Josh » 21 May 2010, 16:19

- make sure the modem is plugged in
- leave away the -R and -m parameter
- add the -W parameter to get detailed information
- run

#./usb_modeswitch -W -v 05c6 -p 1000 -V 16d5 -P 6502 -n -M "5553424328932a86000000000000061b000000020000000000000000000000"

dmitriyku
Posts: 4
Joined: 21 May 2010, 07:31

Post by dmitriyku » 22 May 2010, 05:33

Taking all parameters from the command line


* usb-modeswitch: handle USB devices with multiple modes
* Version 1.1.2alpha (C) Josua Dietze 2010
* Based on libusb0 (0.1.12 and above)

! PLEASE REPORT NEW CONFIGURATIONS !

DefaultVendor= 0x05c6
DefaultProduct= 0x1000
TargetVendor= 0x16d5
TargetProduct= 0x6502
TargetClass= not set

DetachStorageOnly=0
HuaweiMode=0
SierraMode=0
SonyMode=0
GCTMode=0
MessageEndpoint= not set
MessageContent="5553424328932a86000000000000061b000000020000000000000000000000"
NeedResponse=1
ResponseEndpoint= not set
Interface=0x00

InquireDevice enabled (default)
Success check disabled
System integration mode disabled

usb_set_debug: Setting debugging level to 15 (on)
usb_os_find_busses: Found /dev/usb0
usb_os_find_busses: Found /dev/usb1
usb_os_find_busses: Found /dev/usb2
usb_os_find_busses: Found /dev/usb3
usb_os_find_busses: Found /dev/usb4
usb_os_find_busses: Found /dev/usb5

Looking for target devices ...
No devices in target mode or class found
Looking for default devices ...
No devices in default mode or class found. Nothing to do. Bye.

Josh
Site Admin
Posts: 6570
Joined: 03 Nov 2007, 00:30

Post by Josh » 22 May 2010, 07:55

The device search doesn't do anything on your system.
The busses should be searched for any attached devices, which does not happen.

Can you check your version of libusb? The file name will give you a hint.

There might be more success with annother version.

dmitriyku
Posts: 4
Joined: 21 May 2010, 07:31

Post by dmitriyku » 22 May 2010, 09:13

# pkg_info -a | grep usb
libusb-0.1.12 USB access library

Josh
Site Admin
Posts: 6570
Joined: 03 Nov 2007, 00:30

Post by Josh » 22 May 2010, 16:42

I just googled a bit. Conclusion:

- the new libusb1.0 is not ported to OpenBSD yet

- the problem with device searching is known. See this.

Post Reply