disconnect USB - is it possible?


Results 1 to 9 of 9

Threaded View

  1. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default

    Totally untested thought...
    what happen if you stop calling USBSERVICE?

    thereafter, what may happen if you use the method shown in the famous known "POST 148"

    Code:
    ' snip
    usb_device_state   var byte EXT
    CONFIGURED_STATE   CON EXT
    
    DoUSBinit:
        pause 500
        usbinit ' initialise USB...
        repeat  ' kick-start it
            usbservice
        until usb_device_state = CONFIGURED_STATE
    POST 148
    http://www.picbasic.co.uk/forum/show...&postcount=148

    EDIT 1:
    Here's the complete list for usb_device_state var
    Code:
    ; USB Device States - To be used with [byte usb_device_state]
    #define	DETACHED_STATE		0
    #define	ATTACHED_STATE		1
    #define	POWERED_STATE		2
    #define	DEFAULT_STATE		3
    #define	ADR_PENDING_STATE	4
    #define	ADDRESS_STATE		5
    #define	CONFIGURED_STATE	6

    EDIT:2
    I don't think you can relly on that ding-dong noise... check USBDemo, it has this fake led showing if the device is connected or not. An another alternative is to use USBDeview...
    http://www.nirsoft.net/utils/usb_devices_view.html
    Last edited by mister_e; - 10th November 2008 at 19:26.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. USB CDC Communications for Dummies!
    By Squibcakes in forum USB
    Replies: 104
    Last Post: - 15th January 2014, 13:43
  2. Simple USB Comms Problem
    By awmt102 in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 6th January 2010, 20:17
  3. One USB keyboard to Two USB Ports
    By picnaut in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 11th June 2009, 00:04
  4. Replies: 15
    Last Post: - 30th October 2007, 19:25
  5. USB PIC without USB Connection
    By Tissy in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 26th December 2005, 17:39

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts