Re: usb/91546: [umodem] [patch] Nokia 6630 mobile phone does not work
The following reply was made to PR usb/91546; it has been noted by GNATS. From: Eugene Grosbein [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED], M. Warner Losh [EMAIL PROTECTED] Subject: Re: usb/91546: [umodem] [patch] Nokia 6630 mobile phone does not work Date: Fri, 28 Sep 2007 21:25:30 +0800 Hi! Here is the patch allowing to work with Nokia E50 (and hopefully others) as USB modem through device /dev/cuaU0 or like. This is basically the same code from NetBSD with one addition. The code from NetBSD allows to use UNION interface descriptor instead of CM descriptor but takes the first UNION descriptor it finds. That does not work for modern devices having lots of UNION descriptors, where needed is not first. The code uses umodem_get_desc() function to fine UNION, so I made it restartable with additional parameter. To start search from the beginning, the caller passes NULL, or it may pass the descriptor returned by umodem_get_desc() and it continues the search from the next descriptor. The function umodem_get_caps() obtains additional parameters and one of them is device control interface. It ignores any UNION which master interface is not device control interface and that has not at lease two endpoints (we need bulk in and out). So, it successfully finds needed descriptor in my case, attaches the device and it works. --- sys/dev/usb/umodem.c.orig 2007-09-26 21:22:37.0 +0800 +++ sys/dev/usb/umodem.c 2007-09-28 21:01:06.0 +0800 @@ -172,13 +172,14 @@ struct task sc_task; }; -Static void *umodem_get_desc(usbd_device_handle dev, int type, int subtype); +Static void *umodem_get_desc(usbd_device_handle dev, usb_descriptor_t *, int type, int subtype); +Static usbd_interface_handle umodem_get_interface(struct usb_attach_arg *uaa, int ifcno); Static usbd_status umodem_set_comm_feature(struct umodem_softc *sc, int feature, int state); Static usbd_status umodem_set_line_coding(struct umodem_softc *sc, usb_cdc_line_state_t *state); -Static void umodem_get_caps(usbd_device_handle, int *, int *); +Static intumodem_get_caps(struct usb_attach_arg *, int, int *, int *); Static void umodem_get_status(void *, int portno, u_char *lsr, u_char *msr); Static void umodem_set(void *, int, int, int); @@ -261,10 +262,7 @@ if (ret == UMATCH_NONE) return (ret); - umodem_get_caps(uaa-device, cm, acm); - if (!(cm USB_CDC_CM_DOES_CM) || - !(cm USB_CDC_CM_OVER_DATA) || - !(acm USB_CDC_ACM_HAS_LINE)) + if (umodem_get_caps(uaa, -1, cm, acm) == -1) return (UMATCH_NONE); return ret; @@ -276,7 +274,6 @@ usbd_device_handle dev = uaa-device; usb_interface_descriptor_t *id; usb_endpoint_descriptor_t *ed; - usb_cdc_cm_descriptor_t *cmd; char *devinfo = NULL; const char *devname; usbd_status err; @@ -304,15 +301,14 @@ id-bInterfaceClass, id-bInterfaceSubClass); sc-sc_ctl_iface_no = id-bInterfaceNumber; - umodem_get_caps(dev, sc-sc_cm_cap, sc-sc_acm_cap); - /* Get the data interface no. */ - cmd = umodem_get_desc(dev, UDESC_CS_INTERFACE, UDESCSUB_CDC_CM); - if (cmd == NULL) { - printf(%s: no CM descriptor\n, devname); + sc-sc_data_iface_no = data_ifcno = + umodem_get_caps(uaa, sc-sc_ctl_iface_no, sc-sc_cm_cap, sc-sc_acm_cap); + + if (data_ifcno == -1) { + printf(%s: no pointer to data interface\n, devname); goto bad; } - sc-sc_data_iface_no = data_ifcno = cmd-bDataInterface; printf(%s: data interface %d, has %sCM over data, has %sbreak\n, devname, data_ifcno, @@ -550,27 +546,50 @@ ucom_status_change(sc-sc_ucom); } -void -umodem_get_caps(usbd_device_handle dev, int *cm, int *acm) +Static int +umodem_get_caps(struct usb_attach_arg *uaa, int ctl_iface_no, int *cm, int *acm) { usb_cdc_cm_descriptor_t *cmd; usb_cdc_acm_descriptor_t *cad; + usb_cdc_union_descriptor_t *cud; + usbd_device_handle dev = uaa-device; + usbd_interface_handle iface; + int iface_no = 0; *cm = *acm = 0; - cmd = umodem_get_desc(dev, UDESC_CS_INTERFACE, UDESCSUB_CDC_CM); + cmd = umodem_get_desc(dev, NULL, UDESC_CS_INTERFACE, UDESCSUB_CDC_CM); if (cmd == NULL) { DPRINTF((umodem_get_desc: no CM desc\n)); - return; + } else { + *cm = cmd-bmCapabilities; } - *cm = cmd-bmCapabilities; - cad = umodem_get_desc(dev, UDESC_CS_INTERFACE, UDESCSUB_CDC_ACM); + cad = umodem_get_desc(dev, NULL, UDESC_CS_INTERFACE, UDESCSUB_CDC_ACM); if (cad == NULL) { DPRINTF((umodem_get_desc: no ACM
Re: usb/114938: can't attach eli-devices on external hd
Synopsis: can't attach eli-devices on external hd State-Changed-From-To: open-feedback State-Changed-By: pjd State-Changed-When: Fri Sep 28 15:40:23 UTC 2007 State-Changed-Why: Can you send me the following? - diskinfo -v /dev/da0 /dev/da0s1f - geli dump /dev/ad0s1f - last sector of /dev/da0s1f You can get the last sector by executing this command: dd if=/dev/da0s1f of=./last.bin count=1 iseek=`diskinfo /dev/da0s1f | awk '{printf %d\n, $4 - 1}'` Be sure not to initialize da0s1f with any important password/keyfile. Responsible-Changed-From-To: freebsd-usb-pjd Responsible-Changed-By: pjd Responsible-Changed-When: Fri Sep 28 15:40:23 UTC 2007 Responsible-Changed-Why: Can you send me the following? - diskinfo -v /dev/da0 /dev/da0s1f - geli dump /dev/ad0s1f - last sector of /dev/da0s1f You can get the last sector by executing this command: dd if=/dev/da0s1f of=./last.bin count=1 iseek=`diskinfo /dev/da0s1f | awk '{printf %d\n, $4 - 1}'` Be sure not to initialize da0s1f with any important password/keyfile. http://www.freebsd.org/cgi/query-pr.cgi?pr=114938 ___ freebsd-usb@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-usb To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: uscanner: HP ScanJet 4300C
Oliver Fromme wrote: I have bought a HP ScanJet 4300C, specifically because this very scanner is listed in FreeBSD's uscanner(4) manpage and in SANE's list of supported USB scanners. However, this is all I get: uscanner0: vendor 0x03f0 product 0x0305, class 0/0, rev 1.00/0.00, addr 2 on uhub0 uscanner0: setting config no failed device_attach: uscanner0 attach returned 6 uhub0: port 4, set config at addr 2 failed uhub0: device problem (TIMEOUT), disabling port 4 That's on 7-current, but it fails the same way on 6-stable. I've now compiled a kernel with USB_DEBUG, and I also added a few lines of debugging printfs myself. This is what I get: uscanner1: vendor 0x03f0 product 0x0305, class 0/0, rev 1.00/0.00, addr 2 on uhub0 usbd_set_config_no: 1 usbd_get_config_desc: confidx=0 usbd_get_desc: type=2, index=0, len=9 usbd_alloc_xfer() = 0xc3b05200 usbd_transfer: xfer=0xc3b05200, flags=2, pipe=0xc3fda380, running=0 usbd_dump_queue: pipe=0xc3fda380 usb_insert_transfer: pipe=0xc3fda380 running=0 timeout=5000 usb_add_task: task=0xc3b05378 usb_task_thread: woke up task=0xc3b05378 usb_schedsoftintr: polling=0 usb_transfer_complete: pipe=0xc3fda380 xfer=0xc3b05200 status=15 actlen=0 usb_transfer_complete: repeat=0 new head=0 usbd_start_next: pipe=0xc3fda380, xfer=0 usbd_free_xfer: 0xc3b05200 usbd_get_config_desc: usbd_get_desc() -- usbd_status 15 usbd_set_config_no: index 0 -- usbd_status 15 uscanner1: setting config no failed [usbd_status=15] device_attach: uscanner1 attach returned 6 usbd_status 15 is USBD_TIMEOUT. I wanted to run udesc_dump, so I compiled a kernel without uscanner so the device would attach to ugen. However, I get this (after a few seconds): uhub_explore: usb_new_device failed, error=TIMEOUT uhub0: device problem (TIMEOUT), disabling port 2 So I get a timeout again. The problem doesn't seem to be uscanner-related, but more low-level. Any ideas how to proceed? Best regards Oliver PS: I'm pretty sure the scanner is not defective. Also, the USB controller is fine; a flash stick plugged into the same port is working perfectly fine. -- Oliver Fromme, secnetix GmbH Co. KG, Marktplatz 29, 85567 Grafing b. M. Handelsregister: Registergericht Muenchen, HRA 74606, Geschäftsfuehrung: secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün- chen, HRB 125758, Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart FreeBSD-Dienstleistungen, -Produkte und mehr: http://www.secnetix.de/bsd UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things. -- Doug Gwyn ___ freebsd-usb@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-usb To unsubscribe, send any mail to [EMAIL PROTECTED]
USB2.0 card recommendation
Hi, I have an old Pentium-II mainboard with a Celeron processor, and I would like to backup the machine onto external HD. However, the old mainboard only supports USB1.0 which is too slow for that purpose. Therefore I'm looking for a PCI card to teach the machine how to speak USB2.0. Are there any brands that work particularly well with FreeBSD, or models that should be avoided? The card should work reliably and fast. At a shop here there is a card with a VIA chip that costs 5 EUR (~ 3.50 USD). That's suspiciously cheap. Would that card work well with FreeBSD? There's another one with an ALI chip on it, it is 8 EUR (~ 5.70 USD), with otherwise the same specs (4 ext. ports, 1 int. port). There are also more expensive cards which also feature firewire ports, also based on VIA or ALI chips. Any recommendations? Best regards Oliver -- Oliver Fromme, secnetix GmbH Co. KG, Marktplatz 29, 85567 Grafing b. M. Handelsregister: Registergericht Muenchen, HRA 74606, Geschäftsfuehrung: secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün- chen, HRB 125758, Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart FreeBSD-Dienstleistungen, -Produkte und mehr: http://www.secnetix.de/bsd It's trivial to make fun of Microsoft products, but it takes a real man to make them work, and a God to make them do anything useful. ___ freebsd-usb@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-usb To unsubscribe, send any mail to [EMAIL PROTECTED]
snd_uaudio with libusb ?
I have a Linux application that talks to an USB audio dongle that I'm trying to port to FreeBSD. I have no problem with the audio portion, but I'm also trying to use libusb to access the GPIO bits on the chip. If I don't load snd_uaudio /dev/ugen shows up and libusb works fine and I can access the GPIO. However when the sound driver is loaded ugen doesn't bind to the device so libusb can't talk to it. I need simultaneous access to the GPIO and audio functions, either or isn't acceptable. The GPIO bits I need are not supported by HID so that's not an option. Can anyone suggest a solution? Thanks! _ Explore the seven wonders of the world http://search.msn.com/results.aspx?q=7+wonders+worldmkt=en-USform=QBRE___ freebsd-usb@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-usb To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: usb/91546: [umodem] [patch] Nokia 6630 mobile phone does not work
Hi! Here is the patch allowing to work with Nokia E50 (and hopefully others) as USB modem through device /dev/cuaU0 or like. This is basically the same code from NetBSD with one addition. The code from NetBSD allows to use UNION interface descriptor instead of CM descriptor but takes the first UNION descriptor it finds. That does not work for modern devices having lots of UNION descriptors, where needed is not first. The code uses umodem_get_desc() function to fine UNION, so I made it restartable with additional parameter. To start search from the beginning, the caller passes NULL, or it may pass the descriptor returned by umodem_get_desc() and it continues the search from the next descriptor. The function umodem_get_caps() obtains additional parameters and one of them is device control interface. It ignores any UNION which master interface is not device control interface and that has not at lease two endpoints (we need bulk in and out). So, it successfully finds needed descriptor in my case, attaches the device and it works. --- sys/dev/usb/umodem.c.orig 2007-09-26 21:22:37.0 +0800 +++ sys/dev/usb/umodem.c2007-09-28 21:01:06.0 +0800 @@ -172,13 +172,14 @@ struct task sc_task; }; -Static void*umodem_get_desc(usbd_device_handle dev, int type, int subtype); +Static void*umodem_get_desc(usbd_device_handle dev, usb_descriptor_t *, int type, int subtype); +Static usbd_interface_handle umodem_get_interface(struct usb_attach_arg *uaa, int ifcno); Static usbd_status umodem_set_comm_feature(struct umodem_softc *sc, int feature, int state); Static usbd_status umodem_set_line_coding(struct umodem_softc *sc, usb_cdc_line_state_t *state); -Static voidumodem_get_caps(usbd_device_handle, int *, int *); +Static int umodem_get_caps(struct usb_attach_arg *, int, int *, int *); Static voidumodem_get_status(void *, int portno, u_char *lsr, u_char *msr); Static voidumodem_set(void *, int, int, int); @@ -261,10 +262,7 @@ if (ret == UMATCH_NONE) return (ret); - umodem_get_caps(uaa-device, cm, acm); - if (!(cm USB_CDC_CM_DOES_CM) || - !(cm USB_CDC_CM_OVER_DATA) || - !(acm USB_CDC_ACM_HAS_LINE)) + if (umodem_get_caps(uaa, -1, cm, acm) == -1) return (UMATCH_NONE); return ret; @@ -276,7 +274,6 @@ usbd_device_handle dev = uaa-device; usb_interface_descriptor_t *id; usb_endpoint_descriptor_t *ed; - usb_cdc_cm_descriptor_t *cmd; char *devinfo = NULL; const char *devname; usbd_status err; @@ -304,15 +301,14 @@ id-bInterfaceClass, id-bInterfaceSubClass); sc-sc_ctl_iface_no = id-bInterfaceNumber; - umodem_get_caps(dev, sc-sc_cm_cap, sc-sc_acm_cap); - /* Get the data interface no. */ - cmd = umodem_get_desc(dev, UDESC_CS_INTERFACE, UDESCSUB_CDC_CM); - if (cmd == NULL) { - printf(%s: no CM descriptor\n, devname); + sc-sc_data_iface_no = data_ifcno = + umodem_get_caps(uaa, sc-sc_ctl_iface_no, sc-sc_cm_cap, sc-sc_acm_cap); + + if (data_ifcno == -1) { + printf(%s: no pointer to data interface\n, devname); goto bad; } - sc-sc_data_iface_no = data_ifcno = cmd-bDataInterface; printf(%s: data interface %d, has %sCM over data, has %sbreak\n, devname, data_ifcno, @@ -550,27 +546,50 @@ ucom_status_change(sc-sc_ucom); } -void -umodem_get_caps(usbd_device_handle dev, int *cm, int *acm) +Static int +umodem_get_caps(struct usb_attach_arg *uaa, int ctl_iface_no, int *cm, int *acm) { usb_cdc_cm_descriptor_t *cmd; usb_cdc_acm_descriptor_t *cad; + usb_cdc_union_descriptor_t *cud; + usbd_device_handle dev = uaa-device; + usbd_interface_handle iface; + int iface_no = 0; *cm = *acm = 0; - cmd = umodem_get_desc(dev, UDESC_CS_INTERFACE, UDESCSUB_CDC_CM); + cmd = umodem_get_desc(dev, NULL, UDESC_CS_INTERFACE, UDESCSUB_CDC_CM); if (cmd == NULL) { DPRINTF((umodem_get_desc: no CM desc\n)); - return; + } else { + *cm = cmd-bmCapabilities; } - *cm = cmd-bmCapabilities; - cad = umodem_get_desc(dev, UDESC_CS_INTERFACE, UDESCSUB_CDC_ACM); + cad = umodem_get_desc(dev, NULL, UDESC_CS_INTERFACE, UDESCSUB_CDC_ACM); if (cad == NULL) { DPRINTF((umodem_get_desc: no ACM desc\n)); - return; + } else { + *acm = cad-bmCapabilities; + } + + cud = NULL; + while ((cud = umodem_get_desc(dev, (usb_descriptor_t *)cud, + UDESC_CS_INTERFACE, UDESCSUB_CDC_UNION))) + { + iface_no = cud-bSlaveInterface[0]; + if (ctl_iface_no == -1) +
Re: snd_uaudio with libusb ?
On 9/29/07, Chuck T. [EMAIL PROTECTED] wrote: I have a Linux application that talks to an USB audio dongle that I'm trying to port to FreeBSD. I have no problem with the audio portion, but I'm also trying to use libusb to access the GPIO bits on the chip. What is the Linux application? How does the Linux work with the audio and GPIO working at the same time? As far as I know, Linux in libusb needs to unbind the kernel driver using the non-portable usb_detach_kernel_driver_np function in order to have access to the usb device --to set the configuration and claim the interface. I think your device is a USB composite USB device with two interfaces (one for USB audio and the other for GPIO). How do you control the GPIO under Linux (by control transfer or interrupt/bulk transfer)? If the Linux application indeed works at the same time as the USB audio, then Linux does bind different driver to different interfaces (one for the usb audio interface and no driver for the GPIO interface). Ok I am now under FreeBSD and the following is the output from a USB composite device (audio and genric). I have the firmware burnt but I have not built the full USB soundcard. http://home.comcast.net/~armag1234/soundcard.html ===[mcuee] ~/Desktop/build/pyusb-0.4.1/samples # sudo ./usbenum.py Device: /dev/ugen0 Device class: 0 Device sub class: 0 Device protocol: 0 Max packet size: 8 idVendor: 4660 idProduct: 15 Device Version: 00.00 Configuration: 1 Total length: 133 selfPowered: 0 remoteWakeup: 0 maxPower: 200 Interface: 0 Alternate Setting: 0 Interface class: 1 Interface sub class: 1 Interface protocol: 0 Interface: 1 Alternate Setting: 0 Interface class: 1 Interface sub class: 2 Interface protocol: 0 Alternate Setting: 1 Interface class: 1 Interface sub class: 2 Interface protocol: 0 Endpoint: 0x2 Type: 1 Max packet size: 96 Interval: 2 Interface: 2 Alternate Setting: 0 Interface class: 0 Interface sub class: 0 Interface protocol: 0 Endpoint: 0x1 Type: 3 Max packet size: 64 Interval: 1 Endpoint: 0x81 Type: 3 Max packet size: 64 Interval: 1 ===[mcuee] ~ # sudo ls -la /dev/ugen* crw-r--r-- 1 root operator0, 118 Sep 29 09:18 /dev/ugen0 crw-r--r-- 1 root operator0, 117 Sep 29 09:18 /dev/ugen0.1 So it seems that ugen only binds the first interface for this USB composite device. Not so sure if there is a method to bind the other interfaces. I am also not so sure if libusb will work in this case. I am not that experienced with FreeBSD USB. Sorry no real help here. A bit strange that this USB soundcard is not recognized under FreeBSD. I am using an old version of HPS USB stack. Xiaofan http://mcuee.blogspot.com ___ freebsd-usb@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-usb To unsubscribe, send any mail to [EMAIL PROTECTED]
RE: snd_uaudio with libusb ?
On 9/29/07, Chuck T. [EMAIL PROTECTED] wrote: I have a Linux application that talks to an USB audio dongle that I'm trying to port to FreeBSD. I have no problem with the audio portion, but I'm also trying to use libusb to access the GPIO bits on the chip. What is the Linux application? How does the Linux work with the audio and GPIO working at the same time? As far as I know, Linux in libusb needs to unbind the kernel driver using the non-portable usb_detach_kernel_driver_np function in order to have access to the usb device --to set the configuration and claim the interface. It's an (as yet unreleased) ham radio VoIP program called thelinkbox. It connects ham radio repeater systems together using the Internet (http:cqinet.sf.net). Eventually it will support multiple radio ports which is the reason for using USB audio dongles rather than audio cards. The GPIO bits are connected to the push to talk (PTT) of the transmitter. Other GPIO bits are used to interface to an DTMF decoder used to send commands to the computer from the radio. I think your device is a USB composite USB device with two interfaces (one for USB audio and the other for GPIO). How do you control the GPIO under Linux (by control transfer or interrupt/bulk transfer)? If the Linux application indeed works at the same time as the USB audio, then Linux does bind different driver to different interfaces (one for the usb audio interface and no driver for the GPIO interface). I talk to the GPIO bits via vendor specific requests to the control pipe. I do a usb_open() when my application loads and never close it. When I need to set a GPIO bit I use usb_control_msg(). I've never looked under the covers to see why it works, but it does. Ok I am now under FreeBSD and the following is the output from a USB composite device (audio and genric). I have the firmware burnt but I have not built the full USB soundcard. http://home.comcast.net/~armag1234/soundcard.html ===[mcuee] ~/Desktop/build/pyusb-0.4.1/samples # sudo ./usbenum.py Device: /dev/ugen0 Device class: 0 Device sub class: 0 Device protocol: 0 Max packet size: 8 idVendor: 4660 idProduct: 15 Device Version: 00.00 Configuration: 1 Total length: 133 selfPowered: 0 remoteWakeup: 0 maxPower: 200 Interface: 0 Alternate Setting: 0 Interface class: 1 Interface sub class: 1 Interface protocol: 0 Interface: 1 Alternate Setting: 0 Interface class: 1 Interface sub class: 2 Interface protocol: 0 Alternate Setting: 1 Interface class: 1 Interface sub class: 2 Interface protocol: 0 Endpoint: 0x2 Type: 1 Max packet size: 96 Interval: 2 Interface: 2 Alternate Setting: 0 Interface class: 0 Interface sub class: 0 Interface protocol: 0 Endpoint: 0x1 Type: 3 Max packet size: 64 Interval: 1 Endpoint: 0x81 Type: 3 Max packet size: 64 Interval: 1 ===[mcuee] ~ # sudo ls -la /dev/ugen* crw-r--r-- 1 root operator0, 118 Sep 29 09:18 /dev/ugen0 crw-r--r-- 1 root operator0, 117 Sep 29 09:18 /dev/ugen0.1 So it seems that ugen only binds the first interface for this USB composite device. Not so sure if there is a method to bind the other interfaces. I am also not so sure if libusb will work in this case. I am not that experienced with FreeBSD USB. Sorry no real help here. Thanks for responding anyway! _ Discover the new Windows Vista http://search.msn.com/results.aspx?q=windows+vistamkt=en-USform=QBRE___ freebsd-usb@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-usb To unsubscribe, send any mail to [EMAIL PROTECTED]