Re: huawei e220 hsdpa on freebsd 6.3-BETA2

2007-12-08 Thread Joao Barros
On Dec 7, 2007 9:36 AM, [EMAIL PROTECTED]@mgedv.net [EMAIL PROTECTED] wrote:
 but when loading the ucom/ubsa stuff before umass, the device will
 not be recognised as /dev/cdX and show up as a communication device
 (ucom).

I've had success at getting ucom to pickup the serial by connecting
and disconnecting the modem several times.
Since I don't currently use it in FreeBSD I left it at that.
I know it's not the solution but it can be better than nothing.


-- 
Joao Barros
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: huawei e220 hsdpa on freebsd 6.3-BETA2

2007-12-07 Thread [EMAIL PROTECTED]@mgedv.net


Your HSDPA modem presented itself like a mass storage device, probably 
with

some autorun and virus like drivers intended for the Windows operating
system :-)


unfortunately, this is the intended behaviour. this device has the
ability to present itself as mass storage which will show up as a
cd-rom device where the windows drivers are stored on.

this is the way it works under windows:
- plug it in first time
- (auto)run the setup on the device for the win-driver
- as soon as the driver is loaded, the cd device disappears and a modem is 
detected


but when loading the ucom/ubsa stuff before umass, the device will
not be recognised as /dev/cdX and show up as a communication device
(ucom).

of course there must be a way for getting the serial device working,
because this is one of the most sold umts/hsdpa modems across eu and
many people run it under linux as well (there are no drivers from
the vendor provided except windows and mac).
i'm pretty sure there is some message or anything else which will
render this device switching to serial mode.
there is some code, which i found (doesn't compile/run under freebsd)
which puts this device in pure serial mode. maybe someone out there
is able to tell me, how/if this can be done on freebsd as well?
(btw, i'm not a c-guru)

do you (or anybody else reading this) have an idea, how to get this
device working and put it in serial mode completely ?

regards...

THIS IS THE C CODE WHICH WORKS (ANYHOW) ON LINUX:


===
1st: huaweiAktBbo.c
===


/* HUAWEI E220 3G HSDPA modem - Aktivator modemu = aktivuje ttyUSB0 tty USB1
  bobovsky 11.12.2006
  dalej sa uz pouzije usbserial a usb-storage
  cc huaweiAktBbo.c -lusb  (resp -I. -L.)
  armeb-linux-gcc huaweiAktBbo.c -L. -I. -lusb
  Copyright (C) 2006 bobovsky [EMAIL PROTECTED]  GPL
  This program is free software; you can redistribute it and/or modify it 
under the terms of the GNU General Public License2.

*/
#include stdio.h
#include stdlib.h
#include string.h
#include assert.h
#include signal.h
#include ctype.h
#include usb.h
#if 0
#include linux/usbdevice_fs.h
#define LIBUSB_AUGMENT
#include libusb_augment.h
#endif

struct usb_dev_handle *devh;

void release_usb_device(int dummy) {
   int ret;
   ret = usb_release_interface(devh, 0);
   if (!ret)
printf(failed to release interface: %d\n, ret);
   usb_close(devh);
   if (!ret)
printf(failed to close interface: %d\n, ret);
   exit(1);
}

void list_devices() {
   struct usb_bus *bus;
   for (bus = usb_get_busses(); bus; bus = bus-next) {
struct usb_device *dev;

for (dev = bus-devices; dev; dev = dev-next)
printf(0x%04x 0x%04x\n,
dev-descriptor.idVendor,
dev-descriptor.idProduct);
   }
}

struct usb_device *find_device(int vendor, int product) {
   struct usb_bus *bus;

   for (bus = usb_get_busses(); bus; bus = bus-next) {
struct usb_device *dev;

for (dev = bus-devices; dev; dev = dev-next) {
if (dev-descriptor.idVendor == vendor
  dev-descriptor.idProduct == product)
 return dev;
}
   }
   return NULL;
}

void print_bytes(char *bytes, int len) {
   int i;
   if (len  0) {
for (i=0; ilen; i++) {
printf(%02x , (int)((unsigned char)bytes[i]));
}
printf(\);
   for (i=0; ilen; i++) {
printf(%c, isprint(bytes[i]) ? bytes[i] : '.');
   }
   printf(\);
   }
}


int main(int argc, char **argv) {
   int ret, vendor, product;
   struct usb_device *dev;
   char buf[65535], *endptr;
#if 0
   usb_urb *isourb;
   struct timeval isotv;
   char isobuf[32768];
#endif

   usb_init();
//usb_set_debug(255);
   usb_find_busses();
   usb_find_devices();
/*
   if (argc!=3) {
printf(usage: %s vendorID productID\n, argv[0]);
printf(ID numbers of currently attached devices:\n);
list_devices();
exit(1);
   }
   vendor = strtol(argv[1], endptr, 16);
   if (*endptr != '\0') {
printf(invalid vendor id\n);
exit(1);
   }
   product = strtol(argv[2], endptr, 16);
   if (*endptr != '\0') {
printf(invalid product id\n);
exit(1);
   }
*/
   printf(Hladam HUAWEI E220 a prepnem na modem - bbo 06\n);
   vendor = 0x12d1;
   product = 0x1003;
   dev = find_device(vendor, product);
   assert(dev);

   devh = usb_open(dev);
   assert(devh);

   signal(SIGTERM, release_usb_device);

/*
   ret = usb_get_driver_np(devh, 0, buf, sizeof(buf));
   printf(usb_get_driver_np returned %d\n, ret);
   if (ret == 0) {
printf(interface 0 already claimed by driver \%s\, attempting to detach 
it\n, buf);

ret = usb_detach_kernel_driver_np(devh, 0);
printf(usb_detach_kernel_driver_np returned %d\n, ret);
   }
   ret = usb_claim_interface(devh, 0);
   if (ret != 0) {
printf(claim failed with error %d\n, ret);
 exit(1);
   }

   ret = usb_set_altinterface(devh, 0);
   assert(ret = 0);
*/
// BBO typ 1 = DEVICE
ret = usb_get_descriptor(devh, 0x001, 0x000, buf, 0x012);
//printf(1 get descriptor returned %d, bytes: , ret);
//print_bytes(buf, ret);
//printf(\n);
usleep(1*1000);
// BBO typ 2 = CONFIGURATION

Re: huawei e220 hsdpa on freebsd 6.3-BETA2

2007-12-07 Thread Hans Petter Selasky
On Friday 07 December 2007, [EMAIL PROTECTED]@mgedv.net wrote:
  Your HSDPA modem presented itself like a mass storage device, probably
  with
  some autorun and virus like drivers intended for the Windows operating
  system :-)

 unfortunately, this is the intended behaviour. this device has the
 ability to present itself as mass storage which will show up as a
 cd-rom device where the windows drivers are stored on.

 this is the way it works under windows:
 - plug it in first time
 - (auto)run the setup on the device for the win-driver
 - as soon as the driver is loaded, the cd device disappears and a modem is
 detected

 but when loading the ucom/ubsa stuff before umass, the device will
 not be recognised as /dev/cdX and show up as a communication device
 (ucom).

 of course there must be a way for getting the serial device working,
 because this is one of the most sold umts/hsdpa modems across eu and
 many people run it under linux as well (there are no drivers from
 the vendor provided except windows and mac).
 i'm pretty sure there is some message or anything else which will
 render this device switching to serial mode.
 there is some code, which i found (doesn't compile/run under freebsd)
 which puts this device in pure serial mode. maybe someone out there
 is able to tell me, how/if this can be done on freebsd as well?
 (btw, i'm not a c-guru)

 do you (or anybody else reading this) have an idea, how to get this
 device working and put it in serial mode completely ?


Hi,

You can try the following test program and see what happens. You need to run 
it like super-user:

#include stdio.h
#include fcntl.h
#include sys/ioctl.h
#include stdlib.h
#include unistd.h
#include sys/types.h
#include dev/usb/usb.h

int main(int argc, char **argv)
{
  struct usb_ctl_request ucr = { /* zero */ };
  int f;

  if (argc  3) {
  printf(Usage: %s /dev/usb1 addr\n, argv[0]);
  return 1;
  }

  f = open(argv[1], O_RDWR);
  if (f  0) {
  return 1;
  }

  ucr.ucr_addr = atoi(argv[2]);
  ucr.ucr_request.bmRequestType = 0;
  ucr.ucr_request.bRequest = 3; /* SET_FEATURE */
  ucr.ucr_request.wValue[0] = 1;

  if (ioctl(f, USB_REQUEST, ucr)) {
  printf(Error!\n);
  }

  close (f);

  return 0;
}

Use usbdevs -v to get the parameters. Don't forget to load umodem.

If my program doesn't work, I suggest that you contact the manufacturer of 
your modem, and tell them the truth, that the device is a mass-storage device 
and that you want the money back! You paid for a modem, but got a 
mass-storage device. You can tell them that FreeBSD USB experts have looked 
at your device. There is no doubt about it that you've been fooled :-)

--HPS

HINT: HINT: Buy a HDSPA modem that comes with a CD-ROM. Then there is a 
greater chance that they did not put the drivers on the device itself.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


huawei e220 hsdpa on freebsd 6.3-BETA2

2007-12-06 Thread [EMAIL PROTECTED]@mgedv.net


hi folks,

i've got a huawei e220 hsdpa modem, which is connected
to a hp nx8220 notebook (ICH6 usb controller) w. 6.3-BETA2.
i tried GENERIC as well as custom kernels.

this is my current situation:

- custom kernel with just [u,o,e]hci and usb(4) support.
(removed all other usb device support except keyb/mouse)
- patched ubsa as beyond
- loaded ucom(4)
- loaded ubsa(4)
- left out umass(4) or loaded it AFTER ubsa/ucom

dmesg-cut when plugging in the E220 in this scenario:
ucom0: HUAWEI Technologies HUAWEI Mobile, Rev 1.10/0.00, addr 2
ucom0: Could not find interrupt in
device_attach: ucom0 attach returned 6

the patches (/usr/src/sys/dev/usb is base-dir):

--- usbdevs.pre 2007-11-04 03:28:31.0 +
+++ usbdevs 2007-12-06 12:14:46.0 +
@@ -1044,6 +1044,7 @@

/* HUAWEI products */
product HUAWEI MOBILE  0x1001 Huawei Mobile
+product HUAWEI E220  0x1003 Huawei E220 HSDPA USB Modem

/* IBM Corporation */
product IBM USBCDROMDRIVE 0x4427 USB CD-ROM Drive

--- ubsa.c.pre 2007-06-17 09:38:26.0 +
+++ ubsa.c 2007-12-06 12:18:55.0 +
@@ -232,6 +232,8 @@
 { USB_VENDOR_OPTION, USB_PRODUCT_OPTION_GT3GQUAD },
 /* Huawei Mobile */
 { USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_MOBILE },
+ /* Huawei Mobile E220 */
+ { USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_E220 },
 { 0, 0 }
};

usbdevs -v shows the device as:
full speed, power 500mA, config 1, VENDOR 0x12d1, PROD: 0x1003

i really NEED this device to work with freebsd so is
there anybody out there who had such a problem and
solved it?

thx in advance :)
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: huawei e220 hsdpa on freebsd 6.3-BETA2

2007-12-06 Thread Hans Petter Selasky
Hi,

Can you make your modem show up like ugen by loading ugen before plugging 
your device.

Then install /usr/ports/sysutils/udesc_dump and dump all the descriptors of 
your device.

--HPS
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: huawei e220 hsdpa on freebsd 6.3-BETA2

2007-12-06 Thread [EMAIL PROTECTED]@mgedv.net




Can you make your modem show up like ugen by loading ugen before 
plugging

your device.



here it is ;)

Standard Device Descriptor:
 bLength18
 bDescriptorType01
 bcdUSB 0110
 bDeviceClass   00
 bDeviceSubClass00
 bDeviceProtocol00
 bMaxPacketSize 64
 idVendor   12d1
 idProduct  1003
 bcdDevice  
 iManufacturer  1
 iProduct   2
 iSerialNumber  0
 bNumConfigurations 1

Configuration 0:
Standard Configuration Descriptor:
  bLength 9
  bDescriptorType 02
  wTotalLength32
  bNumInterface   1
  bConfigurationValue 1
  iConfiguration  0
  bmAttributesa0 (remote-wakeup)
  bMaxPower   250 (500 mA)

Standard Interface Descriptor:
  bLength9
  bDescriptorType04
  bInterfaceNumber   0
  bAlternateSetting  0
  bNumEndpoints  2
  bInterfaceClass08
  bInterfaceSubClass 06
  bInterfaceProtocol 50
  iInterface 0

Standard Endpoint Descriptor:
  bLength  7
  bDescriptorType  05
  bEndpointAddress 83 (in)
  bmAttributes 02 (Bulk)
  wMaxPacketSize   64
  bInterval0

Standard Endpoint Descriptor:
  bLength  7
  bDescriptorType  05
  bEndpointAddress 04 (out)
  bmAttributes 02 (Bulk)
  wMaxPacketSize   64
  bInterval0

Codes Representing Languages by the Device:
 bLength  4
 bDescriptorType  03
 wLANGID[0]   0409

String (index 1): HUAWEI Technologies

String (index 2): HUAWEI Mobile



___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: huawei e220 hsdpa on freebsd 6.3-BETA2

2007-12-06 Thread Hans Petter Selasky
On Thursday 06 December 2007, [EMAIL PROTECTED]@mgedv.net wrote:
  Can you make your modem show up like ugen by loading ugen before
  plugging
  your device.

 here it is ;)

Hi,

Your HSDPA modem presented itself like a mass storage device, probably with 
some autorun and virus like drivers intended for the Windows operating 
system :-) 

If that is true you bought a memory stick and not a HDSPA modem.

bInterfaceClass08
bInterfaceSubClass 06
bInterfaceProtocol 50

Try loading umass and see for yourself.

Maybe your device cannot be used on non-Windows operating systems.

--HPS
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]